Skip to content

Commit e832fc7

Browse files
committed
Try test 2
1 parent 208806f commit e832fc7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/test_usb.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,10 +1110,16 @@ def test_pulse_collection_consumption(
11101110
tst_consumption.add_log(94, 1, (fixed_this_hour - td(hours=24)), 1000)
11111111
assert tst_consumption.collected_logs == 24
11121112

1113+
11131114
# Test rollover by updating pulses before log record
1115+
pulse_update_3 = fixed_this_hour + td(hours=0, minutes=0, seconds=30)
1116+
tst_consumption.update_pulse_counter(2500, 0, pulse_update_3)
11141117
assert not tst_consumption.log_rollover
1115-
pulse_update_3 = fixed_this_hour + td(hours=1, minutes=1, seconds=3)
1116-
tst_consumption.update_pulse_counter(45, 0, pulse_update_3)
1118+
assert tst_consumption.collected_pulses(
1119+
test_timestamp, is_consumption=True
1120+
) == (45, pulse_update_3)
1121+
pulse_update_4 = fixed_this_hour + td(hours=1, minutes=1, seconds=3)
1122+
tst_consumption.update_pulse_counter(45, 0, pulse_update_)
11171123
assert tst_consumption.log_rollover
11181124
assert tst_consumption.hourly_reset_time == pulse_update_3
11191125
test_timestamp = fixed_this_hour + td(hours=1, minutes=1, seconds=5)
@@ -1126,13 +1132,13 @@ def test_pulse_collection_consumption(
11261132
assert tst_consumption.collected_pulses(
11271133
fixed_this_hour, is_consumption=True
11281134
) == (45 + 2222, pulse_update_3)
1129-
pulse_update_4 = fixed_this_hour + td(hours=1, minutes=1, seconds=18)
1135+
pulse_update_5 = fixed_this_hour + td(hours=1, minutes=1, seconds=18)
11301136
test_timestamp_2 = fixed_this_hour + td(hours=1, minutes=1, seconds=20)
11311137
tst_consumption.update_pulse_counter(145, 0, pulse_update_4)
11321138
# Test collection of the last new hour
11331139
assert tst_consumption.collected_pulses(
11341140
test_timestamp_2, is_consumption=True
1135-
) == (145, pulse_update_4)
1141+
) == (145, pulse_update_5)
11361142
#tst_consumption.add_log(100, 3, (fixed_this_hour + td(hours=2)), 3333)
11371143
#assert not tst_consumption.log_rollover
11381144
#pulse_update_5 = fixed_this_hour + td(hours=2, minutes=1, seconds=18)

0 commit comments

Comments
 (0)