-
Notifications
You must be signed in to change notification settings - Fork 116
Open
Description
I have a dictionary where the keys are instances of a dataclass of a string and an Enum. In a test I want to assert using the has_entries matcher, but it errors because it tries to sort the keys.
They are valid keys, and this matcher is meant to work with dictionaries. My dataclass doesn't need to be sortable for production behaviours.
assert_that(
top_test_step_and_signal_data,
> has_entries(
{
TestStepID(sim_step_view_name, TestStepKind.SIMULATION): equal_to(("sim_signal_x", "sim_signal_y")),
TestStepID(pp_step_view_name, TestStepKind.POST_PROCESS): equal_to(("pp_signal_x", "pp_signal_y")),
TestStepID(plt_step_view_name, TestStepKind.PLOT): empty(),
}
),
)
tests/unittests/server_rpcs/test_run_config_rpc.py:375:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.venv/lib/python3.9/site-packages/hamcrest/library/collection/isdict_containingentries.py:159: in has_entries
return IsDictContainingEntries(base_dict)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[AttributeError("'IsDictContainingEntries' object has no attribute 'value_matchers'") raised in repr()] IsDictContainingEntries object at 0x7f1a47364100>
value_matchers = {TestStepID(name='sim_sweep_v', kind=<TestStepKind.SIMULATION: 1>): <IsEqual(<('sim_signal_x', 'sim_signal_y')>)>, Tes...nal_x', 'pp_signal_y')>)>, TestStepID(name='plt_sweep_v', kind=<TestStepKind.PLOT: 3>): <IsEmpty(an empty collection)>}
def __init__(self, value_matchers) -> None:
> self.value_matchers = sorted(value_matchers.items())
E TypeError: '<' not supported between instances of 'TestStepID' and 'TestStepID'
../../../.venv/lib/python3.9/site-packages/hamcrest/library/collection/isdict_containingentries.py:18: TypeError
Metadata
Metadata
Assignees
Labels
No labels