Skip to content

Commit 9202d83

Browse files
committed
fixup! Add custom comparison for TickInfo objects for pytest
1 parent 47e9944 commit 9202d83

File tree

1 file changed

+6
-4
lines changed
  • tests/timeseries/_resampling/wall_clock_timer

1 file changed

+6
-4
lines changed

tests/timeseries/_resampling/wall_clock_timer/conftest.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,15 @@ def format_val(val: object) -> str:
9494
return report
9595

9696

97-
# We are dealing these fields dynamically, so we make a sanity check here to make sure
98-
# if something changes, we can catch it early instead of getting some cryptic errors
99-
# later, deep in the code.
97+
# We need to compare the fields in TickInfo in a particular way in
98+
# _compare_tick_info_objects. If new fields are added to the dataclass, we'll most
99+
# likely need to add a custom comparison for those fields too. To catch this, we do
100+
# a sanity check here, so if new fields are added we get an early warning instead of
101+
# getting a comparison that misses those fields.
100102
assert set(TickInfo.__dataclass_fields__.keys()) == {
101103
"expected_tick_time",
102104
"sleep_infos",
103-
}
105+
}, "TickInfo fields were added or removed, please update the _compare_tick_info_objects function."
104106

105107

106108
def _compare_tick_info_objects(

0 commit comments

Comments
 (0)