Skip to content

ActivationResults: Add __eq__ and __repr__#258

Merged
fohrloop merged 7 commits intodevfrom
results-eq-operation
Apr 20, 2024
Merged

ActivationResults: Add __eq__ and __repr__#258
fohrloop merged 7 commits intodevfrom
results-eq-operation

Conversation

@fohrloop
Copy link
Copy Markdown
Member

@fohrloop fohrloop commented Apr 20, 2024

ActivationResult

Implement __eq__ and __repr__ (use dataclass). Now it's possible to compare two ActivationResults with "==", and the ActivationResult when printed has more infromation.

Before:

<wakepy.core.activation.ActivationResult at 0x70af4d994f70>

Now:

ActivationResult(modename='foo', active_method='a-successful-method', success=True, real_success=True, failure=False, _method_results=[(FAIL @PLATFORM_SUPPORT, fail-platform, "Platform XYZ not supported!"),(FAIL @REQUIREMENTS, fail-requirements, "Missing requirement: Some SW v.1.2.3"), (SUCCESS, a-successful-method), (UNUSED, some-unused-method)])

In addition, refactor ActivationResult related tests.

Also: ActivationResult cannot be initiated with many succesful methods
anymore. Only one method may be active for given mode at a time anyway,
and previously the exception was raised only when trying to access
ActivationResult.active_method.
@fohrloop fohrloop merged commit de82025 into dev Apr 20, 2024
@fohrloop fohrloop deleted the results-eq-operation branch April 20, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant