Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gjohansson-ST committed Dec 11, 2023
1 parent 4a8b2ad commit 16881a4
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions tests/components/time_date/test_sensor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""The tests for time_date sensor platform."""

from freezegun.api import FrozenDateTimeFactory

import pytest

import homeassistant.components.time_date.sensor as time_date
Expand All @@ -17,13 +16,7 @@ async def test_intervals(hass: HomeAssistant, freezer: FrozenDateTimeFactory) ->
now = dt_util.utc_from_timestamp(45.5)
freezer.move_to(now)
next_time = device.get_next_interval()
assert next_time == dt_util.utc_from_timestamp(60)

device = time_date.TimeDateSensor("beat", "1234567890")
now = dt_util.parse_datetime("2020-11-13 00:00:29+01:00")
freezer.move_to(now)
next_time = device.get_next_interval()
assert next_time == dt_util.parse_datetime("2020-11-13 00:01:26.4+01:00")
assert next_time == dt_util.parse_datetime("1971-01-01 00:01:00+00:00")

Check failure on line 19 in tests/components/time_date/test_sensor.py

View workflow job for this annotation

GitHub Actions / Run tests Python 3.11 (time_date)

test_intervals AssertionError: assert HAFakeDatetime(1970, 1, 1, 0, 1, tzinfo=datetime.timezone.utc) == datetime.datetime(1971, 1, 1, 0, 1, tzinfo=datetime.timezone.utc) + where datetime.datetime(1971, 1, 1, 0, 1, tzinfo=datetime.timezone.utc) = <function parse_datetime at 0x7f1e58e5c680>('1971-01-01 00:01:00+00:00') + where <function parse_datetime at 0x7f1e58e5c680> = dt_util.parse_datetime

Check failure on line 19 in tests/components/time_date/test_sensor.py

View workflow job for this annotation

GitHub Actions / Run tests Python 3.12 (time_date)

test_intervals AssertionError: assert HAFakeDatetime(1970, 1, 1, 0, 1, tzinfo=datetime.timezone.utc) == datetime.datetime(1971, 1, 1, 0, 1, tzinfo=datetime.timezone.utc) + where datetime.datetime(1971, 1, 1, 0, 1, tzinfo=datetime.timezone.utc) = <function parse_datetime at 0x7ff2340dd120>('1971-01-01 00:01:00+00:00') + where <function parse_datetime at 0x7ff2340dd120> = dt_util.parse_datetime

device = time_date.TimeDateSensor("date_time", "1234567890")
now = dt_util.utc_from_timestamp(1495068899)
Expand Down Expand Up @@ -61,9 +54,6 @@ async def test_states(hass: HomeAssistant) -> None:
state = hass.states.get("sensor.date_time_iso")
assert state.state == "2017-05-18T00:54:00"

state = hass.states.get("sensor.beat")
assert state.state == "@079"


@pytest.mark.freeze_time(dt_util.utc_from_timestamp(1495068856))
async def test_states_non_default_timezone(hass: HomeAssistant) -> None:
Expand All @@ -86,9 +76,6 @@ async def test_states_non_default_timezone(hass: HomeAssistant) -> None:
state = hass.states.get("sensor.date_time_utc")
assert state.state == "2017-05-18, 00:54"

state = hass.states.get("sensor.beat")
assert state.state == "@079"

state = hass.states.get("sensor.date_time_iso")
assert state.state == "2017-05-17T20:54:00"

Expand Down

0 comments on commit 16881a4

Please sign in to comment.