1
mirror of https://github.com/home-assistant/core synced 2024-10-07 10:13:38 +02:00

Fix integration trapezoidal test (#93494)

This commit is contained in:
J. Nick Koston 2023-05-24 15:24:15 -05:00 committed by GitHub
parent 41aa3e223e
commit 33c2cb9895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,