-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Result class #51
base: main
Are you sure you want to change the base?
Conversation
I plan to add "timed out" case to the union later.
@loganek do you have any early feedback about the api? |
I left a few comments. It looks ok to me in general, although I'm not really sure if we should have yet another type in the |
@@ -14,14 +14,16 @@ class Failure(NamedTuple): | |||
message: str | |||
|
|||
|
|||
class Result(NamedTuple): | |||
class Executed(NamedTuple): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class Executed(NamedTuple): | |
class ExecutedResult(NamedTuple): |
def failed(self) -> bool: | ||
return len(self.failures) > 0 | ||
|
||
class Skipped(NamedTuple): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class Skipped(NamedTuple): | |
class SkippedResult(NamedTuple): |
reason: str | ||
|
||
|
||
Result = Union[Executed, Skipped] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Result = Union[Executed, Skipped] | |
Result = Union[ExecutedResult, SkippedResult] |
failures: List[Failure] | ||
|
||
@property | ||
def failed(self) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep that property for the Executed
class as it abstracts the implementation detail.
Executed -> ExecutedResult Skipped -> SkippedResult
I plan to add "timed out" case to the union later.
todo: