Skip to content

Commit

Permalink
Fix integration trapezoidal test (#93494)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed May 24, 2023
1 parent 41aa3e2 commit 33c2cb9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/components/integration/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,11 @@ async def test_trapezoidal(hass: HomeAssistant) -> None:
hass.states.async_set(entity_id, 0, {})
await hass.async_block_till_done()

# Testing a power sensor with non-monotonic intervals and values
for time, value in [(20, 10), (30, 30), (40, 5), (50, 0)]:
now = dt_util.utcnow() + timedelta(minutes=time)
with freeze_time(now):
start_time = dt_util.utcnow()
with freeze_time(start_time) as freezer:
# Testing a power sensor with non-monotonic intervals and values
for time, value in [(20, 10), (30, 30), (40, 5), (50, 0)]:
freezer.move_to(start_time + timedelta(minutes=time))
hass.states.async_set(
entity_id,
value,
Expand Down

0 comments on commit 33c2cb9

Please sign in to comment.