Skip to content

Commit 101b1df

Browse files
committed
Move rollover assert to after collected_pulses()
1 parent 3daf616 commit 101b1df

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/test_usb.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,8 +1081,8 @@ def test_pulse_collection_consumption(
10811081
assert tst_consumption.collected_pulses(
10821082
test_timestamp, is_consumption=False
10831083
) == (None, None)
1084-
10851084
assert not tst_consumption.log_rollover
1085+
10861086
# add missing logs
10871087
test_timestamp = fixed_this_hour - td(hours=3)
10881088
tst_consumption.add_log(99, 2, (fixed_this_hour - td(hours=3)), 1000)
@@ -1113,32 +1113,32 @@ def test_pulse_collection_consumption(
11131113
assert not tst_consumption.log_rollover
11141114
pulse_update_3 = fixed_this_hour + td(hours=1, seconds=3)
11151115
tst_consumption.update_pulse_counter(45, 0, pulse_update_3)
1116-
assert tst_consumption.log_rollover
11171116
test_timestamp = fixed_this_hour + td(hours=1, seconds=5)
11181117
assert tst_consumption.collected_pulses(
11191118
test_timestamp, is_consumption=True
11201119
) == (None, None)
1120+
assert tst_consumption.log_rollover
11211121
tst_consumption.add_log(100, 2, (fixed_this_hour + td(hours=1)), 2222)
1122-
assert not tst_consumption.log_rollover
11231122
assert tst_consumption.collected_pulses(
11241123
test_timestamp, is_consumption=True
11251124
) == (45, pulse_update_3)
11261125
assert tst_consumption.collected_pulses(
11271126
fixed_this_hour, is_consumption=True
11281127
) == (45 + 2222, pulse_update_3)
1128+
assert not tst_consumption.log_rollover
11291129

11301130
# Test log rollover by updating log first before updating pulses
11311131
tst_consumption.add_log(100, 3, (fixed_this_hour + td(hours=2)), 3333)
1132-
assert tst_consumption.log_rollover
11331132
assert tst_consumption.collected_pulses(
11341133
fixed_this_hour, is_consumption=True
11351134
) == (None, None)
1135+
assert tst_consumption.log_rollover
11361136
pulse_update_4 = fixed_this_hour + td(hours=2, seconds=10)
11371137
tst_consumption.update_pulse_counter(321, 0, pulse_update_4)
1138-
assert not tst_consumption.log_rollover
11391138
assert tst_consumption.collected_pulses(
11401139
fixed_this_hour, is_consumption=True
11411140
) == (2222 + 3333 + 321, pulse_update_4)
1141+
assert not tst_consumption.log_rollover
11421142

11431143
@freeze_time(dt.now())
11441144
def test_pulse_collection_consumption_empty(

0 commit comments

Comments
 (0)