Unignore Ruff PLR in tests (#114470)
* Unignore Ruff PLR in tests * Address review comments * review comments * fix import * Update test_api.py * Update test_api.py * Update test_api.py
This commit is contained in:
parent
dc59073f25
commit
d5f883fbf0
169 changed files with 211 additions and 266 deletions
|
@ -3,11 +3,11 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN,
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
CONF_PLATFORM,
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN,
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
|
|
|
@ -5,11 +5,11 @@ from datetime import timedelta
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.alarm_control_panel import (
|
||||
DOMAIN,
|
||||
AlarmControlPanelEntityFeature,
|
||||
)
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
|
|
|
@ -4,7 +4,7 @@ from copy import deepcopy
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.alert as alert
|
||||
from homeassistant.components import alert, notify
|
||||
from homeassistant.components.alert.const import (
|
||||
CONF_ALERT_MESSAGE,
|
||||
CONF_DATA,
|
||||
|
@ -14,7 +14,6 @@ from homeassistant.components.alert.const import (
|
|||
CONF_TITLE,
|
||||
DOMAIN,
|
||||
)
|
||||
import homeassistant.components.notify as notify
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
CONF_ENTITY_ID,
|
||||
|
|
|
@ -5,8 +5,8 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import camera
|
||||
from homeassistant.components.alexa import smart_home, state_report
|
||||
import homeassistant.components.camera as camera
|
||||
from homeassistant.components.climate import ClimateEntityFeature
|
||||
from homeassistant.components.cover import CoverDeviceClass, CoverEntityFeature
|
||||
from homeassistant.components.media_player import MediaPlayerEntityFeature
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
from unittest.mock import patch
|
||||
|
||||
from androidtv.adb_manager.adb_manager_async import DeviceAsync
|
||||
from androidtv.constants import CMD_DEVICE_PROPERTIES, CMD_MAC_ETH0, CMD_MAC_WLAN0
|
||||
|
||||
from homeassistant.components.androidtv.const import (
|
||||
|
@ -62,7 +63,7 @@ class ClientAsyncFakeFail:
|
|||
"""Initialize a `ClientAsyncFakeFail` instance."""
|
||||
self._devices = []
|
||||
|
||||
async def device(self, serial):
|
||||
async def device(self, serial) -> DeviceAsync | None:
|
||||
"""Mock the `ClientAsync.device` method when the device is not connected via ADB."""
|
||||
self._devices = []
|
||||
return None
|
||||
|
|
|
@ -9,7 +9,7 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.apache_kafka as apache_kafka
|
||||
from homeassistant.components import apache_kafka
|
||||
from homeassistant.const import STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -7,7 +7,7 @@ import aprslib
|
|||
from aprslib import IS
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.aprs.device_tracker as device_tracker
|
||||
from homeassistant.components.aprs import device_tracker
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
DEFAULT_PORT = 14580
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.arcam_fmj.const import DOMAIN
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -727,7 +727,7 @@ def test_pipeline_run_equality(hass: HomeAssistant, init_components) -> None:
|
|||
event_callback=event_callback,
|
||||
)
|
||||
|
||||
assert run_1 == run_1
|
||||
assert run_1 == run_1 # noqa: PLR0124
|
||||
assert run_1 != run_2
|
||||
assert run_1 != 1234
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from unittest.mock import Mock, patch
|
|||
import pytest
|
||||
|
||||
from homeassistant import config_entries
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.automation import (
|
||||
ATTR_SOURCE,
|
||||
DOMAIN,
|
||||
|
|
|
@ -29,7 +29,6 @@ class MockBAFDevice(Device):
|
|||
"""Mock async_wait_available."""
|
||||
if self._async_wait_available_side_effect:
|
||||
raise self._async_wait_available_side_effect
|
||||
return
|
||||
|
||||
def async_run(self):
|
||||
"""Mock async_run."""
|
||||
|
|
|
@ -6,7 +6,7 @@ from freezegun import freeze_time
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDeviceClass
|
||||
from homeassistant.components.binary_sensor.device_condition import ENTITY_CONDITIONS
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.binary_sensor import DOMAIN, BinarySensorDeviceClass
|
||||
from homeassistant.components.binary_sensor.device_trigger import ENTITY_TRIGGERS
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
|
|
|
@ -624,7 +624,7 @@ async def test_remove_item(
|
|||
assert state.state == "1"
|
||||
|
||||
def lookup(uid: str) -> Mock:
|
||||
assert uid == "2" or uid == "3"
|
||||
assert uid in ("2", "3")
|
||||
if uid == "2":
|
||||
return item1
|
||||
return item2
|
||||
|
|
|
@ -20,8 +20,7 @@ import zoneinfo
|
|||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import calendar
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation, calendar
|
||||
from homeassistant.components.calendar.trigger import EVENT_END, EVENT_START
|
||||
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.climate import DOMAIN, HVACMode, const, device_action
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import EntityCategory
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.climate import DOMAIN, HVACMode, const, device_condition
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import EntityCategory
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.climate import (
|
||||
DOMAIN,
|
||||
HVACAction,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from datetime import timedelta
|
||||
|
||||
import homeassistant.components.configurator as configurator
|
||||
from homeassistant.components import configurator
|
||||
from homeassistant.const import ATTR_FRIENDLY_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.cover import DOMAIN, CoverEntityFeature
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import CONF_PLATFORM, EntityCategory
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.cover import DOMAIN, CoverEntityFeature
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.cover import DOMAIN, CoverEntityFeature
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -4,7 +4,7 @@ from enum import Enum
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.cover as cover
|
||||
from homeassistant.components import cover
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
CONF_PLATFORM,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
import homeassistant.components.datadog as datadog
|
||||
from homeassistant.components import datadog
|
||||
from homeassistant.const import EVENT_LOGBOOK_ENTRY, STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -6,8 +6,8 @@ from unittest.mock import patch
|
|||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import notify
|
||||
import homeassistant.components.demo.notify as demo
|
||||
import homeassistant.components.notify as notify
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers import discovery
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -4,7 +4,7 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.remote as remote
|
||||
from homeassistant.components import remote
|
||||
from homeassistant.components.remote import ATTR_COMMAND
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
|
|
@ -8,8 +8,7 @@ from pytest_unordered import unordered
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries, loader
|
||||
from homeassistant.components import device_automation
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation, device_automation
|
||||
from homeassistant.components.device_automation import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
toggle_entity,
|
||||
|
|
|
@ -4,7 +4,7 @@ from datetime import timedelta
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.device_tracker import DOMAIN
|
||||
from homeassistant.const import STATE_HOME, EntityCategory
|
||||
|
|
|
@ -4,10 +4,9 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation, zone
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.device_tracker import DOMAIN, device_trigger
|
||||
import homeassistant.components.zone as zone
|
||||
from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import (
|
||||
|
|
|
@ -9,8 +9,7 @@ from unittest.mock import Mock, call, patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import zone
|
||||
import homeassistant.components.device_tracker as device_tracker
|
||||
from homeassistant.components import device_tracker, zone
|
||||
from homeassistant.components.device_tracker import SourceType, const, legacy
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_PICTURE,
|
||||
|
|
|
@ -7,6 +7,7 @@ from unittest.mock import MagicMock
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant import const
|
||||
from homeassistant.components import climate
|
||||
from homeassistant.components.climate import ClimateEntityFeature
|
||||
from homeassistant.components.ecobee.climate import (
|
||||
|
@ -14,7 +15,6 @@ from homeassistant.components.ecobee.climate import (
|
|||
PRESET_AWAY_INDEFINITELY,
|
||||
Thermostat,
|
||||
)
|
||||
import homeassistant.const as const
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, STATE_OFF
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.fan import DOMAIN
|
||||
from homeassistant.const import EntityCategory
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.fan import DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.fan import DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory
|
||||
|
|
|
@ -6,8 +6,8 @@ from unittest.mock import MagicMock
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import sensor
|
||||
from homeassistant.components.foobot import sensor as foobot
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.const import (
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
|
||||
CONCENTRATION_PARTS_PER_BILLION,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import homeassistant.components.button as button
|
||||
from homeassistant.components import button
|
||||
from homeassistant.components.fully_kiosk.const import DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
from homeassistant.components import media_player
|
||||
from homeassistant.components.fully_kiosk.const import DOMAIN, MEDIA_SUPPORT_FULLYKIOSK
|
||||
import homeassistant.components.media_player as media_player
|
||||
from homeassistant.components.media_source import DOMAIN as MS_DOMAIN
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from homeassistant.components import number
|
||||
from homeassistant.components.fully_kiosk.const import DOMAIN, UPDATE_INTERVAL
|
||||
import homeassistant.components.number as number
|
||||
from homeassistant.const import ATTR_ENTITY_ID, STATE_UNKNOWN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from homeassistant.components import switch
|
||||
from homeassistant.components.fully_kiosk.const import DOMAIN
|
||||
import homeassistant.components.switch as switch
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -255,7 +255,6 @@ def mock_events_list(
|
|||
json=resp,
|
||||
exc=exc,
|
||||
)
|
||||
return
|
||||
|
||||
return _put_result
|
||||
|
||||
|
@ -268,7 +267,6 @@ def mock_events_list_items(
|
|||
|
||||
def _put_items(items: list[dict[str, Any]]) -> None:
|
||||
mock_events_list({"items": items})
|
||||
return
|
||||
|
||||
return _put_items
|
||||
|
||||
|
@ -289,7 +287,6 @@ def mock_calendars_list(
|
|||
json=resp,
|
||||
exc=exc,
|
||||
)
|
||||
return
|
||||
|
||||
return _result
|
||||
|
||||
|
@ -312,7 +309,6 @@ def mock_calendar_get(
|
|||
exc=exc,
|
||||
status=status,
|
||||
)
|
||||
return
|
||||
|
||||
return _result
|
||||
|
||||
|
@ -330,7 +326,6 @@ def mock_insert_event(
|
|||
f"{API_BASE_URL}/calendars/{calendar_id}/events",
|
||||
exc=exc,
|
||||
)
|
||||
return
|
||||
|
||||
return _expect_result
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
import os
|
||||
import unittest.mock as mock
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.google_pubsub as google_pubsub
|
||||
from homeassistant.components import google_pubsub
|
||||
from homeassistant.components.google_pubsub import DateTimeJSONEncoder as victim
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -8,7 +8,7 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.group as group
|
||||
from homeassistant.components import group
|
||||
from homeassistant.const import (
|
||||
ATTR_ASSUMED_STATE,
|
||||
ATTR_FRIENDLY_NAME,
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from homeassistant import config as hass_config
|
||||
from homeassistant.components import notify
|
||||
import homeassistant.components.demo.notify as demo
|
||||
from homeassistant.components.group import SERVICE_RELOAD
|
||||
import homeassistant.components.group.notify as group
|
||||
import homeassistant.components.notify as notify
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
|
|
@ -379,8 +379,8 @@ async def test_ingress_request_get_compressed(
|
|||
|
||||
# Check we got right response
|
||||
assert resp.status == HTTPStatus.OK
|
||||
body = await resp.text()
|
||||
assert body == body
|
||||
resp_body = await resp.text()
|
||||
assert resp_body == body
|
||||
assert resp.headers["Content-Encoding"] == "deflate"
|
||||
|
||||
# Check we forwarded command
|
||||
|
|
|
@ -162,13 +162,11 @@ def test_get_significant_states_without_initial(hass_history) -> None:
|
|||
one_with_microsecond = zero + timedelta(seconds=1, microseconds=1)
|
||||
one_and_half = zero + timedelta(seconds=1.5)
|
||||
for entity_id in states:
|
||||
states[entity_id] = list(
|
||||
filter(
|
||||
lambda s: s.last_changed != one
|
||||
and s.last_changed != one_with_microsecond,
|
||||
states[entity_id],
|
||||
)
|
||||
)
|
||||
states[entity_id] = [
|
||||
s
|
||||
for s in states[entity_id]
|
||||
if s.last_changed not in (one, one_with_microsecond)
|
||||
]
|
||||
del states["media_player.test2"]
|
||||
|
||||
hist = get_significant_states(
|
||||
|
|
|
@ -148,7 +148,7 @@ def test_get_significant_states_with_initial(legacy_hass_history) -> None:
|
|||
if entity_id == "media_player.test":
|
||||
states[entity_id] = states[entity_id][1:]
|
||||
for state in states[entity_id]:
|
||||
if state.last_changed == one or state.last_changed == one_with_microsecond:
|
||||
if state.last_changed in (one, one_with_microsecond):
|
||||
state.last_changed = one_and_half
|
||||
state.last_updated = one_and_half
|
||||
|
||||
|
@ -177,8 +177,7 @@ def test_get_significant_states_without_initial(legacy_hass_history) -> None:
|
|||
for entity_id in states:
|
||||
states[entity_id] = list(
|
||||
filter(
|
||||
lambda s: s.last_changed != one
|
||||
and s.last_changed != one_with_microsecond,
|
||||
lambda s: s.last_changed not in (one, one_with_microsecond),
|
||||
states[entity_id],
|
||||
)
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ENTITY_MATCH_ALL, SERVICE_TURN_OFF
|
||||
from homeassistant.core import Context, HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -4,7 +4,7 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.core import CoreState, HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -8,7 +8,7 @@ from freezegun.api import FrozenDateTimeFactory
|
|||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.homeassistant.triggers import (
|
||||
numeric_state as numeric_state_trigger,
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ from unittest.mock import patch
|
|||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.homeassistant.triggers import state as state_trigger
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
|
|
|
@ -6,8 +6,8 @@ from freezegun.api import FrozenDateTimeFactory
|
|||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
import homeassistant.components.homeassistant.triggers.time_pattern as time_pattern
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.homeassistant.triggers import time_pattern
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ENTITY_MATCH_ALL, SERVICE_TURN_OFF
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -67,7 +67,6 @@ def _mock_socket(failure_attempts: int = 0) -> MagicMock:
|
|||
attempts += 1
|
||||
if attempts <= failure_attempts:
|
||||
raise OSError
|
||||
return
|
||||
|
||||
mock_socket.bind = Mock(side_effect=_simulate_bind)
|
||||
return mock_socket
|
||||
|
|
|
@ -5,7 +5,7 @@ from aiohomekit.model.services import ServicesTypes
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.homekit_controller.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
|
|
|
@ -10,7 +10,7 @@ from aiohttp.web_exceptions import HTTPUnauthorized
|
|||
from aiohttp.web_middlewares import middleware
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.http as http
|
||||
from homeassistant.components import http
|
||||
from homeassistant.components.http import KEY_AUTHENTICATED, KEY_HASS
|
||||
from homeassistant.components.http.ban import (
|
||||
IP_BANS_FILE,
|
||||
|
|
|
@ -13,7 +13,7 @@ import pytest
|
|||
from homeassistant.auth.providers.legacy_api_password import (
|
||||
LegacyApiPasswordAuthProvider,
|
||||
)
|
||||
import homeassistant.components.http as http
|
||||
from homeassistant.components import http
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.http import KEY_HASS
|
||||
from homeassistant.helpers.network import NoURLAvailableError
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.humidifier import DOMAIN, const, device_action
|
||||
from homeassistant.const import STATE_ON, EntityCategory
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.humidifier import DOMAIN, const, device_condition
|
||||
from homeassistant.const import ATTR_MODE, STATE_OFF, STATE_ON, EntityCategory
|
||||
|
|
|
@ -6,7 +6,7 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.humidifier import DOMAIN, const, device_trigger
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -4,7 +4,7 @@ from unittest.mock import PropertyMock, patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.http as http
|
||||
from homeassistant.components import http
|
||||
import homeassistant.components.image_processing as ip
|
||||
from homeassistant.const import ATTR_ENTITY_PICTURE
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -7,7 +7,7 @@ from unittest.mock import ANY, MagicMock, Mock, call, patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.influxdb as influxdb
|
||||
from homeassistant.components import influxdb
|
||||
from homeassistant.components.influxdb.const import DEFAULT_BUCKET
|
||||
from homeassistant.const import PERCENTAGE, STATE_OFF, STATE_ON, STATE_STANDBY
|
||||
from homeassistant.core import HomeAssistant, split_entity_id
|
||||
|
|
|
@ -12,6 +12,7 @@ from influxdb_client.rest import ApiException
|
|||
import pytest
|
||||
from voluptuous import Invalid
|
||||
|
||||
from homeassistant.components import sensor
|
||||
from homeassistant.components.influxdb.const import (
|
||||
API_VERSION_2,
|
||||
DEFAULT_API_VERSION,
|
||||
|
@ -22,7 +23,6 @@ from homeassistant.components.influxdb.const import (
|
|||
TEST_QUERY_V2,
|
||||
)
|
||||
from homeassistant.components.influxdb.sensor import PLATFORM_SCHEMA
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.const import STATE_UNKNOWN
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import PLATFORM_NOT_READY_BASE_WAIT_TIME
|
||||
|
|
|
@ -7,7 +7,7 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.kira as kira
|
||||
from homeassistant.components import kira
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
|
|
@ -279,4 +279,3 @@ def load_knxproj(hass_storage):
|
|||
"version": 1,
|
||||
"data": FIXTURE_PROJECT_DATA,
|
||||
}
|
||||
return
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.kodi import DOMAIN
|
||||
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.light import (
|
||||
ATTR_SUPPORTED_COLOR_MODES,
|
||||
|
@ -168,7 +168,7 @@ async def test_get_action_capabilities(
|
|||
capabilities = await async_get_device_automation_capabilities(
|
||||
hass, DeviceAutomationType.ACTION, action
|
||||
)
|
||||
assert capabilities == {"extra_fields": []} or capabilities == {}
|
||||
assert capabilities in ({"extra_fields": []}, {})
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
@ -6,7 +6,7 @@ from freezegun import freeze_time
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON, EntityCategory
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory
|
||||
|
|
|
@ -8,7 +8,7 @@ from unittest.mock import patch
|
|||
import pytest
|
||||
|
||||
from homeassistant import setup
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.lock import DOMAIN, LockEntityFeature
|
||||
from homeassistant.const import EntityCategory
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.lock import DOMAIN
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.lock import DOMAIN
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -4,7 +4,7 @@ from unittest.mock import ANY, call, patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.logentries as logentries
|
||||
from homeassistant.components import logentries
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -9,7 +9,7 @@ from aiohttp.test_utils import TestClient
|
|||
import pytest
|
||||
|
||||
from homeassistant.bootstrap import async_setup_component
|
||||
import homeassistant.components.mailbox as mailbox
|
||||
from homeassistant.components import mailbox
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.media_player import DOMAIN
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.media_player import DOMAIN
|
||||
from homeassistant.const import (
|
||||
|
|
|
@ -5,7 +5,7 @@ import json
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.device_tracker as device_tracker
|
||||
from homeassistant.components import device_tracker
|
||||
from homeassistant.components.device_tracker import legacy
|
||||
from homeassistant.components.meraki.device_tracker import (
|
||||
CONF_SECRET,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""The tests for the mFi sensor platform."""
|
||||
|
||||
from copy import deepcopy
|
||||
import unittest.mock as mock
|
||||
from unittest import mock
|
||||
|
||||
from mficlient.client import FailedToLogin
|
||||
import pytest
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""The tests for the mFi switch platform."""
|
||||
|
||||
import unittest.mock as mock
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@ from typing import Any
|
|||
from freezegun import freeze_time
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import mikrotik
|
||||
import homeassistant.components.device_tracker as device_tracker
|
||||
from homeassistant.components import device_tracker, mikrotik
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""The tests for the mochad light platform."""
|
||||
|
||||
import unittest.mock as mock
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""The tests for the mochad switch platform."""
|
||||
|
||||
import unittest.mock as mock
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import sensor
|
||||
from homeassistant.components.mold_indicator.sensor import (
|
||||
ATTR_CRITICAL_TEMP,
|
||||
ATTR_DEWPOINT,
|
||||
)
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
PERCENTAGE,
|
||||
|
|
|
@ -5,7 +5,7 @@ import json
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.mqtt import _LOGGER, DOMAIN, debug_info
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
|
|
|
@ -4,7 +4,7 @@ from unittest.mock import ANY
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ENTITY_MATCH_ALL, SERVICE_TURN_OFF
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -6,8 +6,8 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import sensor
|
||||
from homeassistant.components.mqtt import CONF_QOS, CONF_STATE_TOPIC, DEFAULT_QOS
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE_ID,
|
||||
CONF_NAME,
|
||||
|
|
|
@ -11,6 +11,7 @@ The tests below exercise both cases during integration setup.
|
|||
import time
|
||||
from unittest.mock import patch
|
||||
|
||||
from google_nest_sdm.google_nest_subscriber import GoogleNestSubscriber
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.nest.const import API_URL, OAUTH2_TOKEN, SDM_SCOPES
|
||||
|
@ -55,7 +56,7 @@ async def test_auth(
|
|||
|
||||
async def async_new_subscriber(
|
||||
creds, subscription_name, event_loop, async_callback
|
||||
):
|
||||
) -> GoogleNestSubscriber | None:
|
||||
"""Capture credentials for tests."""
|
||||
nonlocal captured_creds
|
||||
captured_creds = creds
|
||||
|
@ -123,7 +124,7 @@ async def test_auth_expired_token(
|
|||
|
||||
async def async_new_subscriber(
|
||||
creds, subscription_name, event_loop, async_callback
|
||||
):
|
||||
) -> GoogleNestSubscriber | None:
|
||||
"""Capture credentials for tests."""
|
||||
nonlocal captured_creds
|
||||
captured_creds = creds
|
||||
|
|
|
@ -4,7 +4,7 @@ from google_nest_sdm.event import EventMessage
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.device_automation.exceptions import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.netatmo import DOMAIN as NETATMO_DOMAIN
|
||||
from homeassistant.components.netatmo.const import (
|
||||
|
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
from pytest_unordered import unordered
|
||||
import voluptuous_serialize
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.number import DOMAIN, device_action
|
||||
from homeassistant.const import EntityCategory
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import homeassistant.components.button as button
|
||||
from homeassistant.components import button
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import pytest
|
||||
from pytest_unordered import unordered
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.philips_js.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -4,8 +4,7 @@ import logging
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import pilight
|
||||
import homeassistant.components.sensor as sensor
|
||||
from homeassistant.components import pilight, sensor
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from pypjlink import MUTE_AUDIO
|
|||
from pypjlink.projector import ProjectorError
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.media_player as media_player
|
||||
from homeassistant.components import media_player
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import homeassistant.components.plant as plant
|
||||
from homeassistant.components import plant
|
||||
from homeassistant.components.recorder import Recorder
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
|
|
|
@ -10,7 +10,7 @@ import plexapi
|
|||
import requests
|
||||
import requests_mock
|
||||
|
||||
import homeassistant.components.plex.const as const
|
||||
from homeassistant.components.plex import const
|
||||
from homeassistant.components.plex.models import (
|
||||
LIVE_TV_SECTION,
|
||||
TRANSIENT_SECTION,
|
||||
|
|
|
@ -47,9 +47,9 @@ async def test_setup(hass: HomeAssistant) -> None:
|
|||
)
|
||||
|
||||
assert len(mock_ex.mock_calls) == 1
|
||||
hass, script, source, data = mock_ex.mock_calls[0][1]
|
||||
test_hass, script, source, data = mock_ex.mock_calls[0][1]
|
||||
|
||||
assert hass is hass
|
||||
assert test_hass is hass
|
||||
assert script == "hello.py"
|
||||
assert source == "fake source"
|
||||
assert data == {"some": "data"}
|
||||
|
|
|
@ -636,13 +636,11 @@ def test_get_significant_states_without_initial(
|
|||
one_with_microsecond = zero + timedelta(seconds=1, microseconds=1)
|
||||
one_and_half = zero + timedelta(seconds=1.5)
|
||||
for entity_id in states:
|
||||
states[entity_id] = list(
|
||||
filter(
|
||||
lambda s: s.last_changed != one
|
||||
and s.last_changed != one_with_microsecond,
|
||||
states[entity_id],
|
||||
)
|
||||
)
|
||||
states[entity_id] = [
|
||||
s
|
||||
for s in states[entity_id]
|
||||
if s.last_changed not in (one, one_with_microsecond)
|
||||
]
|
||||
del states["media_player.test2"]
|
||||
del states["thermostat.test3"]
|
||||
|
||||
|
|
|
@ -384,10 +384,7 @@ def test_get_significant_states_with_initial(
|
|||
if entity_id == "media_player.test":
|
||||
states[entity_id] = states[entity_id][1:]
|
||||
for state in states[entity_id]:
|
||||
if (
|
||||
state.last_changed == one
|
||||
or state.last_changed == one_with_microsecond
|
||||
):
|
||||
if state.last_changed in (one, one_with_microsecond):
|
||||
state.last_changed = one_and_half
|
||||
state.last_updated = one_and_half
|
||||
|
||||
|
@ -418,13 +415,11 @@ def test_get_significant_states_without_initial(
|
|||
one_with_microsecond = zero + timedelta(seconds=1, microseconds=1)
|
||||
one_and_half = zero + timedelta(seconds=1.5)
|
||||
for entity_id in states:
|
||||
states[entity_id] = list(
|
||||
filter(
|
||||
lambda s: s.last_changed != one
|
||||
and s.last_changed != one_with_microsecond,
|
||||
states[entity_id],
|
||||
)
|
||||
)
|
||||
states[entity_id] = [
|
||||
s
|
||||
for s in states[entity_id]
|
||||
if s.last_changed not in (one, one_with_microsecond)
|
||||
]
|
||||
del states["media_player.test2"]
|
||||
|
||||
hist = history.get_significant_states(
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue