diff --git a/tests/components/alarm_control_panel/test_device_action.py b/tests/components/alarm_control_panel/test_device_action.py index afcfa0a7a1260..5d142ab277b33 100644 --- a/tests/components/alarm_control_panel/test_device_action.py +++ b/tests/components/alarm_control_panel/test_device_action.py @@ -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, diff --git a/tests/components/alarm_control_panel/test_device_condition.py b/tests/components/alarm_control_panel/test_device_condition.py index d95574b7c9faf..b6ee6b2faaa28 100644 --- a/tests/components/alarm_control_panel/test_device_condition.py +++ b/tests/components/alarm_control_panel/test_device_condition.py @@ -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, diff --git a/tests/components/alarm_control_panel/test_device_trigger.py b/tests/components/alarm_control_panel/test_device_trigger.py index be241ef241e22..00cdc5ddbee44 100644 --- a/tests/components/alarm_control_panel/test_device_trigger.py +++ b/tests/components/alarm_control_panel/test_device_trigger.py @@ -5,11 +5,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, diff --git a/tests/components/alert/test_init.py b/tests/components/alert/test_init.py index 7c4030b56daee..31236c84f3484 100644 --- a/tests/components/alert/test_init.py +++ b/tests/components/alert/test_init.py @@ -4,7 +4,7 @@ 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 @@ CONF_TITLE, DOMAIN, ) -import homeassistant.components.notify as notify from homeassistant.const import ( ATTR_ENTITY_ID, CONF_ENTITY_ID, diff --git a/tests/components/alexa/test_smart_home.py b/tests/components/alexa/test_smart_home.py index b7e6a5e53ac05..fa8d7a2c9fb02 100644 --- a/tests/components/alexa/test_smart_home.py +++ b/tests/components/alexa/test_smart_home.py @@ -5,8 +5,8 @@ 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 diff --git a/tests/components/androidtv/patchers.py b/tests/components/androidtv/patchers.py index 67393a21f41e2..90a13523ebed6 100644 --- a/tests/components/androidtv/patchers.py +++ b/tests/components/androidtv/patchers.py @@ -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 @@ def __init__(self, host=ADB_SERVER_HOST, port=DEFAULT_ADB_SERVER_PORT) -> None: """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 diff --git a/tests/components/apache_kafka/test_init.py b/tests/components/apache_kafka/test_init.py index 93d9619f0c3e3..2b70204605427 100644 --- a/tests/components/apache_kafka/test_init.py +++ b/tests/components/apache_kafka/test_init.py @@ -9,7 +9,7 @@ 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 diff --git a/tests/components/aprs/test_device_tracker.py b/tests/components/aprs/test_device_tracker.py index ca2a5ce183349..92081111c8bf9 100644 --- a/tests/components/aprs/test_device_tracker.py +++ b/tests/components/aprs/test_device_tracker.py @@ -7,7 +7,7 @@ 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 diff --git a/tests/components/arcam_fmj/test_device_trigger.py b/tests/components/arcam_fmj/test_device_trigger.py index a8510628b2664..1b43d27281c7a 100644 --- a/tests/components/arcam_fmj/test_device_trigger.py +++ b/tests/components/arcam_fmj/test_device_trigger.py @@ -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 diff --git a/tests/components/assist_pipeline/test_init.py b/tests/components/assist_pipeline/test_init.py index c6f45044cb3df..f9b91af3bf1aa 100644 --- a/tests/components/assist_pipeline/test_init.py +++ b/tests/components/assist_pipeline/test_init.py @@ -727,7 +727,7 @@ def event_callback(event): 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 diff --git a/tests/components/automation/test_init.py b/tests/components/automation/test_init.py index 00a7e6980d739..3e569586a2a18 100644 --- a/tests/components/automation/test_init.py +++ b/tests/components/automation/test_init.py @@ -9,7 +9,7 @@ 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, diff --git a/tests/components/baf/__init__.py b/tests/components/baf/__init__.py index 648f235349d69..09288c4a87417 100644 --- a/tests/components/baf/__init__.py +++ b/tests/components/baf/__init__.py @@ -29,7 +29,6 @@ async def async_wait_available(self): """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.""" diff --git a/tests/components/binary_sensor/test_device_condition.py b/tests/components/binary_sensor/test_device_condition.py index 83451313bad53..93689b4f2332d 100644 --- a/tests/components/binary_sensor/test_device_condition.py +++ b/tests/components/binary_sensor/test_device_condition.py @@ -6,7 +6,7 @@ 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 diff --git a/tests/components/binary_sensor/test_device_trigger.py b/tests/components/binary_sensor/test_device_trigger.py index ad7bd9c3528d8..76dcdb33993cf 100644 --- a/tests/components/binary_sensor/test_device_trigger.py +++ b/tests/components/binary_sensor/test_device_trigger.py @@ -5,7 +5,7 @@ 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 diff --git a/tests/components/caldav/test_todo.py b/tests/components/caldav/test_todo.py index 67fc5f7f443e5..bea4725856e71 100644 --- a/tests/components/caldav/test_todo.py +++ b/tests/components/caldav/test_todo.py @@ -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 diff --git a/tests/components/calendar/test_trigger.py b/tests/components/calendar/test_trigger.py index 050329cd85520..54cfd35361800 100644 --- a/tests/components/calendar/test_trigger.py +++ b/tests/components/calendar/test_trigger.py @@ -20,8 +20,7 @@ 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 diff --git a/tests/components/climate/test_device_action.py b/tests/components/climate/test_device_action.py index 3ee5a9b8eddf2..850f8b6c84353 100644 --- a/tests/components/climate/test_device_action.py +++ b/tests/components/climate/test_device_action.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/climate/test_device_condition.py b/tests/components/climate/test_device_condition.py index d9345a0516c2a..e44802f7d4d7d 100644 --- a/tests/components/climate/test_device_condition.py +++ b/tests/components/climate/test_device_condition.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/climate/test_device_trigger.py b/tests/components/climate/test_device_trigger.py index 7dbe106bd4ff8..af14c42c086de 100644 --- a/tests/components/climate/test_device_trigger.py +++ b/tests/components/climate/test_device_trigger.py @@ -4,7 +4,7 @@ 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, diff --git a/tests/components/configurator/test_init.py b/tests/components/configurator/test_init.py index 44813f01a18eb..6c937473ddc7d 100644 --- a/tests/components/configurator/test_init.py +++ b/tests/components/configurator/test_init.py @@ -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 diff --git a/tests/components/cover/test_device_action.py b/tests/components/cover/test_device_action.py index 43bf7431626c2..e70e8d3a70f90 100644 --- a/tests/components/cover/test_device_action.py +++ b/tests/components/cover/test_device_action.py @@ -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 diff --git a/tests/components/cover/test_device_condition.py b/tests/components/cover/test_device_condition.py index a58f94f44f32a..d1a542e660811 100644 --- a/tests/components/cover/test_device_condition.py +++ b/tests/components/cover/test_device_condition.py @@ -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 ( diff --git a/tests/components/cover/test_device_trigger.py b/tests/components/cover/test_device_trigger.py index 5db52b6d61832..afd39fe6d8e21 100644 --- a/tests/components/cover/test_device_trigger.py +++ b/tests/components/cover/test_device_trigger.py @@ -5,7 +5,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 ( diff --git a/tests/components/cover/test_init.py b/tests/components/cover/test_init.py index ec090b878f281..0052093298eef 100644 --- a/tests/components/cover/test_init.py +++ b/tests/components/cover/test_init.py @@ -4,7 +4,7 @@ import pytest -import homeassistant.components.cover as cover +from homeassistant.components import cover from homeassistant.const import ( ATTR_ENTITY_ID, CONF_PLATFORM, diff --git a/tests/components/datadog/test_init.py b/tests/components/datadog/test_init.py index 51d698186b75e..36c1d9510781e 100644 --- a/tests/components/datadog/test_init.py +++ b/tests/components/datadog/test_init.py @@ -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 diff --git a/tests/components/demo/test_notify.py b/tests/components/demo/test_notify.py index 54eadc3bd9110..0bc7a8bc1d899 100644 --- a/tests/components/demo/test_notify.py +++ b/tests/components/demo/test_notify.py @@ -6,8 +6,8 @@ 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 diff --git a/tests/components/demo/test_remote.py b/tests/components/demo/test_remote.py index e2a82248fdfa4..bcab2fb3de036 100644 --- a/tests/components/demo/test_remote.py +++ b/tests/components/demo/test_remote.py @@ -4,7 +4,7 @@ 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, diff --git a/tests/components/device_automation/test_init.py b/tests/components/device_automation/test_init.py index 1a4488e43cd57..32e624f1c8c71 100644 --- a/tests/components/device_automation/test_init.py +++ b/tests/components/device_automation/test_init.py @@ -8,8 +8,7 @@ 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, diff --git a/tests/components/device_automation/test_toggle_entity.py b/tests/components/device_automation/test_toggle_entity.py index 59d316545fa35..44a29d4a9ba74 100644 --- a/tests/components/device_automation/test_toggle_entity.py +++ b/tests/components/device_automation/test_toggle_entity.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/device_tracker/test_device_condition.py b/tests/components/device_tracker/test_device_condition.py index 431840d2f577f..18f3d64ec0e4f 100644 --- a/tests/components/device_tracker/test_device_condition.py +++ b/tests/components/device_tracker/test_device_condition.py @@ -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 diff --git a/tests/components/device_tracker/test_device_trigger.py b/tests/components/device_tracker/test_device_trigger.py index 1bbe2394d8e45..67c41b85752a1 100644 --- a/tests/components/device_tracker/test_device_trigger.py +++ b/tests/components/device_tracker/test_device_trigger.py @@ -4,10 +4,9 @@ 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 ( diff --git a/tests/components/device_tracker/test_init.py b/tests/components/device_tracker/test_init.py index b36ffdf14f63c..cc6cf5c1c1e72 100644 --- a/tests/components/device_tracker/test_init.py +++ b/tests/components/device_tracker/test_init.py @@ -9,8 +9,7 @@ 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, diff --git a/tests/components/ecobee/test_climate.py b/tests/components/ecobee/test_climate.py index 0ec4f9cee689b..7ea9950e2d4ae 100644 --- a/tests/components/ecobee/test_climate.py +++ b/tests/components/ecobee/test_climate.py @@ -7,6 +7,7 @@ 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 @@ 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 diff --git a/tests/components/fan/test_device_action.py b/tests/components/fan/test_device_action.py index c08e061770024..96e02ab55922f 100644 --- a/tests/components/fan/test_device_action.py +++ b/tests/components/fan/test_device_action.py @@ -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 diff --git a/tests/components/fan/test_device_condition.py b/tests/components/fan/test_device_condition.py index afd237d19744c..72e1dfb4ca268 100644 --- a/tests/components/fan/test_device_condition.py +++ b/tests/components/fan/test_device_condition.py @@ -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 diff --git a/tests/components/fan/test_device_trigger.py b/tests/components/fan/test_device_trigger.py index 92b6443f24187..c121569184fb9 100644 --- a/tests/components/fan/test_device_trigger.py +++ b/tests/components/fan/test_device_trigger.py @@ -5,7 +5,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 diff --git a/tests/components/foobot/test_sensor.py b/tests/components/foobot/test_sensor.py index d8beae3b77bd4..d5461ae71c76d 100644 --- a/tests/components/foobot/test_sensor.py +++ b/tests/components/foobot/test_sensor.py @@ -6,8 +6,8 @@ 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, diff --git a/tests/components/fully_kiosk/test_button.py b/tests/components/fully_kiosk/test_button.py index 9bd4c3a897cf4..4652ee9604723 100644 --- a/tests/components/fully_kiosk/test_button.py +++ b/tests/components/fully_kiosk/test_button.py @@ -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 diff --git a/tests/components/fully_kiosk/test_media_player.py b/tests/components/fully_kiosk/test_media_player.py index b8719a578aa7d..b6eff4cfa2c7c 100644 --- a/tests/components/fully_kiosk/test_media_player.py +++ b/tests/components/fully_kiosk/test_media_player.py @@ -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 diff --git a/tests/components/fully_kiosk/test_number.py b/tests/components/fully_kiosk/test_number.py index b4ac50cb07694..2fbbf751725c4 100644 --- a/tests/components/fully_kiosk/test_number.py +++ b/tests/components/fully_kiosk/test_number.py @@ -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 diff --git a/tests/components/fully_kiosk/test_switch.py b/tests/components/fully_kiosk/test_switch.py index 03ac00ef67768..5b3b5e651b018 100644 --- a/tests/components/fully_kiosk/test_switch.py +++ b/tests/components/fully_kiosk/test_switch.py @@ -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 diff --git a/tests/components/google/conftest.py b/tests/components/google/conftest.py index 989e66906303e..37a652e37521a 100644 --- a/tests/components/google/conftest.py +++ b/tests/components/google/conftest.py @@ -255,7 +255,6 @@ def _put_result( 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 _result(response: dict[str, Any], exc: ClientError | None = None) -> None: json=resp, exc=exc, ) - return return _result @@ -312,7 +309,6 @@ def _result( exc=exc, status=status, ) - return return _result @@ -330,7 +326,6 @@ def _expect_result( f"{API_BASE_URL}/calendars/{calendar_id}/events", exc=exc, ) - return return _expect_result diff --git a/tests/components/google_pubsub/test_init.py b/tests/components/google_pubsub/test_init.py index e397ab2c403e2..a793ade531213 100644 --- a/tests/components/google_pubsub/test_init.py +++ b/tests/components/google_pubsub/test_init.py @@ -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 diff --git a/tests/components/group/test_init.py b/tests/components/group/test_init.py index 45846123a805e..0f8d487b340f0 100644 --- a/tests/components/group/test_init.py +++ b/tests/components/group/test_init.py @@ -8,7 +8,7 @@ import pytest -import homeassistant.components.group as group +from homeassistant.components import group from homeassistant.const import ( ATTR_ASSUMED_STATE, ATTR_FRIENDLY_NAME, diff --git a/tests/components/group/test_notify.py b/tests/components/group/test_notify.py index 52d049431d848..5709e64850843 100644 --- a/tests/components/group/test_notify.py +++ b/tests/components/group/test_notify.py @@ -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 diff --git a/tests/components/hassio/test_ingress.py b/tests/components/hassio/test_ingress.py index 27e99f7f596af..805b5292edbd2 100644 --- a/tests/components/hassio/test_ingress.py +++ b/tests/components/hassio/test_ingress.py @@ -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 diff --git a/tests/components/history/test_init.py b/tests/components/history/test_init.py index 5d9cb86f9b6ea..d0712b968bc89 100644 --- a/tests/components/history/test_init.py +++ b/tests/components/history/test_init.py @@ -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( diff --git a/tests/components/history/test_init_db_schema_30.py b/tests/components/history/test_init_db_schema_30.py index ce5c5a4b6c692..2e26256da908c 100644 --- a/tests/components/history/test_init_db_schema_30.py +++ b/tests/components/history/test_init_db_schema_30.py @@ -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], ) ) diff --git a/tests/components/homeassistant/triggers/test_event.py b/tests/components/homeassistant/triggers/test_event.py index a0c1f6cb45d46..451f35f66fe29 100644 --- a/tests/components/homeassistant/triggers/test_event.py +++ b/tests/components/homeassistant/triggers/test_event.py @@ -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 diff --git a/tests/components/homeassistant/triggers/test_homeassistant.py b/tests/components/homeassistant/triggers/test_homeassistant.py index ebe9041501832..2afb533cdc0f2 100644 --- a/tests/components/homeassistant/triggers/test_homeassistant.py +++ b/tests/components/homeassistant/triggers/test_homeassistant.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/homeassistant/triggers/test_numeric_state.py b/tests/components/homeassistant/triggers/test_numeric_state.py index 65c2863d0d789..cf2e1938228ff 100644 --- a/tests/components/homeassistant/triggers/test_numeric_state.py +++ b/tests/components/homeassistant/triggers/test_numeric_state.py @@ -8,7 +8,7 @@ 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, ) diff --git a/tests/components/homeassistant/triggers/test_state.py b/tests/components/homeassistant/triggers/test_state.py index 9d1d60031e0f9..aaf228c06f890 100644 --- a/tests/components/homeassistant/triggers/test_state.py +++ b/tests/components/homeassistant/triggers/test_state.py @@ -6,7 +6,7 @@ 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, diff --git a/tests/components/homeassistant/triggers/test_time_pattern.py b/tests/components/homeassistant/triggers/test_time_pattern.py index 2d814813ed478..2324599c3c62a 100644 --- a/tests/components/homeassistant/triggers/test_time_pattern.py +++ b/tests/components/homeassistant/triggers/test_time_pattern.py @@ -6,8 +6,8 @@ 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 diff --git a/tests/components/homekit/test_util.py b/tests/components/homekit/test_util.py index c419f7c19e7bf..17e38a0a14533 100644 --- a/tests/components/homekit/test_util.py +++ b/tests/components/homekit/test_util.py @@ -67,7 +67,6 @@ def _simulate_bind(*_): attempts += 1 if attempts <= failure_attempts: raise OSError - return mock_socket.bind = Mock(side_effect=_simulate_bind) return mock_socket diff --git a/tests/components/homekit_controller/test_device_trigger.py b/tests/components/homekit_controller/test_device_trigger.py index 40f565ec88ba0..239d170a84f66 100644 --- a/tests/components/homekit_controller/test_device_trigger.py +++ b/tests/components/homekit_controller/test_device_trigger.py @@ -5,7 +5,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.homekit_controller.const import DOMAIN from homeassistant.config_entries import ConfigEntryState diff --git a/tests/components/http/test_ban.py b/tests/components/http/test_ban.py index a10aa74026892..91476bf46982f 100644 --- a/tests/components/http/test_ban.py +++ b/tests/components/http/test_ban.py @@ -10,7 +10,7 @@ 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, diff --git a/tests/components/http/test_init.py b/tests/components/http/test_init.py index 98e97d0fe57b5..9e892e2ee43e3 100644 --- a/tests/components/http/test_init.py +++ b/tests/components/http/test_init.py @@ -13,7 +13,7 @@ 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 diff --git a/tests/components/humidifier/test_device_action.py b/tests/components/humidifier/test_device_action.py index 13c41fd836935..567be27721f97 100644 --- a/tests/components/humidifier/test_device_action.py +++ b/tests/components/humidifier/test_device_action.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/humidifier/test_device_condition.py b/tests/components/humidifier/test_device_condition.py index fa17d1bb732d3..ad4ac78d0644d 100644 --- a/tests/components/humidifier/test_device_condition.py +++ b/tests/components/humidifier/test_device_condition.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/humidifier/test_device_trigger.py b/tests/components/humidifier/test_device_trigger.py index 3e05f6b02d1bb..e064e82a385d1 100644 --- a/tests/components/humidifier/test_device_trigger.py +++ b/tests/components/humidifier/test_device_trigger.py @@ -6,7 +6,7 @@ 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 ( diff --git a/tests/components/image_processing/test_init.py b/tests/components/image_processing/test_init.py index 6415e4e2a4e6b..62027552fb026 100644 --- a/tests/components/image_processing/test_init.py +++ b/tests/components/image_processing/test_init.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/influxdb/test_init.py b/tests/components/influxdb/test_init.py index 41f14aa78e315..cd95248eb331d 100644 --- a/tests/components/influxdb/test_init.py +++ b/tests/components/influxdb/test_init.py @@ -7,7 +7,7 @@ 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 diff --git a/tests/components/influxdb/test_sensor.py b/tests/components/influxdb/test_sensor.py index 395d33004a733..d3464c7e417c2 100644 --- a/tests/components/influxdb/test_sensor.py +++ b/tests/components/influxdb/test_sensor.py @@ -12,6 +12,7 @@ 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 @@ 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 diff --git a/tests/components/kira/test_init.py b/tests/components/kira/test_init.py index 6b6ad4c1fcf09..a200c25d2a32e 100644 --- a/tests/components/kira/test_init.py +++ b/tests/components/kira/test_init.py @@ -7,7 +7,7 @@ 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 diff --git a/tests/components/knx/conftest.py b/tests/components/knx/conftest.py index bd724029516a9..92a9e3594ee7e 100644 --- a/tests/components/knx/conftest.py +++ b/tests/components/knx/conftest.py @@ -279,4 +279,3 @@ def load_knxproj(hass_storage): "version": 1, "data": FIXTURE_PROJECT_DATA, } - return diff --git a/tests/components/kodi/test_device_trigger.py b/tests/components/kodi/test_device_trigger.py index 1737fe5d7c99c..2a3c1f7544fd7 100644 --- a/tests/components/kodi/test_device_trigger.py +++ b/tests/components/kodi/test_device_trigger.py @@ -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 diff --git a/tests/components/light/test_device_action.py b/tests/components/light/test_device_action.py index 3f8ed8adbb6d4..d2a13f222532c 100644 --- a/tests/components/light/test_device_action.py +++ b/tests/components/light/test_device_action.py @@ -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( diff --git a/tests/components/light/test_device_condition.py b/tests/components/light/test_device_condition.py index 16237547bc92b..caaa51e86fa86 100644 --- a/tests/components/light/test_device_condition.py +++ b/tests/components/light/test_device_condition.py @@ -6,7 +6,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 DOMAIN from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON, EntityCategory diff --git a/tests/components/light/test_device_trigger.py b/tests/components/light/test_device_trigger.py index ff692432d3181..ea1c1c66b21cf 100644 --- a/tests/components/light/test_device_trigger.py +++ b/tests/components/light/test_device_trigger.py @@ -5,7 +5,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 DOMAIN from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory diff --git a/tests/components/litejet/test_trigger.py b/tests/components/litejet/test_trigger.py index b9379efdad495..9746ab92cad5c 100644 --- a/tests/components/litejet/test_trigger.py +++ b/tests/components/litejet/test_trigger.py @@ -8,7 +8,7 @@ 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 diff --git a/tests/components/lock/test_device_action.py b/tests/components/lock/test_device_action.py index 3396324284bab..3b46117ccd2a3 100644 --- a/tests/components/lock/test_device_action.py +++ b/tests/components/lock/test_device_action.py @@ -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 diff --git a/tests/components/lock/test_device_condition.py b/tests/components/lock/test_device_condition.py index 71e1b6ac48ebb..749e1037662f0 100644 --- a/tests/components/lock/test_device_condition.py +++ b/tests/components/lock/test_device_condition.py @@ -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 ( diff --git a/tests/components/lock/test_device_trigger.py b/tests/components/lock/test_device_trigger.py index a45fd7527b54e..3f518143285cd 100644 --- a/tests/components/lock/test_device_trigger.py +++ b/tests/components/lock/test_device_trigger.py @@ -5,7 +5,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 ( diff --git a/tests/components/logentries/test_init.py b/tests/components/logentries/test_init.py index 40e73a86c0508..a75d83660a82b 100644 --- a/tests/components/logentries/test_init.py +++ b/tests/components/logentries/test_init.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/mailbox/test_init.py b/tests/components/mailbox/test_init.py index 8b83f2b0ec73d..296a4fbfa6b31 100644 --- a/tests/components/mailbox/test_init.py +++ b/tests/components/mailbox/test_init.py @@ -9,7 +9,7 @@ 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 diff --git a/tests/components/media_player/test_device_condition.py b/tests/components/media_player/test_device_condition.py index 3d020b01c3d5d..d64161b8409fe 100644 --- a/tests/components/media_player/test_device_condition.py +++ b/tests/components/media_player/test_device_condition.py @@ -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 ( diff --git a/tests/components/media_player/test_device_trigger.py b/tests/components/media_player/test_device_trigger.py index 3f347918f3d76..ab11683889de3 100644 --- a/tests/components/media_player/test_device_trigger.py +++ b/tests/components/media_player/test_device_trigger.py @@ -5,7 +5,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 ( diff --git a/tests/components/meraki/test_device_tracker.py b/tests/components/meraki/test_device_tracker.py index d0cd2cf8c5aac..d5d61516c08b7 100644 --- a/tests/components/meraki/test_device_tracker.py +++ b/tests/components/meraki/test_device_tracker.py @@ -5,7 +5,7 @@ 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, diff --git a/tests/components/mfi/test_sensor.py b/tests/components/mfi/test_sensor.py index 24f6a52fa5c84..49efdd5dc7191 100644 --- a/tests/components/mfi/test_sensor.py +++ b/tests/components/mfi/test_sensor.py @@ -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 diff --git a/tests/components/mfi/test_switch.py b/tests/components/mfi/test_switch.py index 6c69787beef19..03b5d5f2c0ab9 100644 --- a/tests/components/mfi/test_switch.py +++ b/tests/components/mfi/test_switch.py @@ -1,6 +1,6 @@ """The tests for the mFi switch platform.""" -import unittest.mock as mock +from unittest import mock import pytest diff --git a/tests/components/mikrotik/test_device_tracker.py b/tests/components/mikrotik/test_device_tracker.py index 89dc37fd78139..1eec2132a9147 100644 --- a/tests/components/mikrotik/test_device_tracker.py +++ b/tests/components/mikrotik/test_device_tracker.py @@ -8,8 +8,7 @@ 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 diff --git a/tests/components/mochad/test_light.py b/tests/components/mochad/test_light.py index b04f9a13933a4..872bd3a9d6123 100644 --- a/tests/components/mochad/test_light.py +++ b/tests/components/mochad/test_light.py @@ -1,6 +1,6 @@ """The tests for the mochad light platform.""" -import unittest.mock as mock +from unittest import mock import pytest diff --git a/tests/components/mochad/test_switch.py b/tests/components/mochad/test_switch.py index 96c3ba60b65e0..750dd48296ef7 100644 --- a/tests/components/mochad/test_switch.py +++ b/tests/components/mochad/test_switch.py @@ -1,6 +1,6 @@ """The tests for the mochad switch platform.""" -import unittest.mock as mock +from unittest import mock import pytest diff --git a/tests/components/mold_indicator/test_sensor.py b/tests/components/mold_indicator/test_sensor.py index 0acea3d03e670..760d82dfedc57 100644 --- a/tests/components/mold_indicator/test_sensor.py +++ b/tests/components/mold_indicator/test_sensor.py @@ -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, diff --git a/tests/components/mqtt/test_device_trigger.py b/tests/components/mqtt/test_device_trigger.py index 4f4c9a18bd900..465e87205fada 100644 --- a/tests/components/mqtt/test_device_trigger.py +++ b/tests/components/mqtt/test_device_trigger.py @@ -5,7 +5,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.mqtt import _LOGGER, DOMAIN, debug_info from homeassistant.core import HomeAssistant, ServiceCall diff --git a/tests/components/mqtt/test_trigger.py b/tests/components/mqtt/test_trigger.py index 90a39bfd4fbbc..ceb9207e0c2e3 100644 --- a/tests/components/mqtt/test_trigger.py +++ b/tests/components/mqtt/test_trigger.py @@ -4,7 +4,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 HomeAssistant from homeassistant.setup import async_setup_component diff --git a/tests/components/mqtt_room/test_sensor.py b/tests/components/mqtt_room/test_sensor.py index bc1890f08fa80..e6fe7db3b8eb0 100644 --- a/tests/components/mqtt_room/test_sensor.py +++ b/tests/components/mqtt_room/test_sensor.py @@ -6,8 +6,8 @@ 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, diff --git a/tests/components/nest/test_api.py b/tests/components/nest/test_api.py index 3e0932c607dee..fd07233fa8cbc 100644 --- a/tests/components/nest/test_api.py +++ b/tests/components/nest/test_api.py @@ -11,6 +11,7 @@ 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 diff --git a/tests/components/nest/test_device_trigger.py b/tests/components/nest/test_device_trigger.py index 51cf42546144f..44fb6bcf70195 100644 --- a/tests/components/nest/test_device_trigger.py +++ b/tests/components/nest/test_device_trigger.py @@ -4,7 +4,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_automation.exceptions import ( InvalidDeviceAutomationConfig, diff --git a/tests/components/netatmo/test_device_trigger.py b/tests/components/netatmo/test_device_trigger.py index f7c31d7681cb7..566bc72426be8 100644 --- a/tests/components/netatmo/test_device_trigger.py +++ b/tests/components/netatmo/test_device_trigger.py @@ -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 ( diff --git a/tests/components/number/test_device_action.py b/tests/components/number/test_device_action.py index 0c34f1bf53cda..92a7cefd467eb 100644 --- a/tests/components/number/test_device_action.py +++ b/tests/components/number/test_device_action.py @@ -4,7 +4,7 @@ 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 diff --git a/tests/components/opengarage/test_button.py b/tests/components/opengarage/test_button.py index 3742b7c8aec5f..4ace809f56401 100644 --- a/tests/components/opengarage/test_button.py +++ b/tests/components/opengarage/test_button.py @@ -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 diff --git a/tests/components/philips_js/test_device_trigger.py b/tests/components/philips_js/test_device_trigger.py index 3a59e3c66624f..3fbac81acbf29 100644 --- a/tests/components/philips_js/test_device_trigger.py +++ b/tests/components/philips_js/test_device_trigger.py @@ -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 diff --git a/tests/components/pilight/test_sensor.py b/tests/components/pilight/test_sensor.py index 629f0f13de441..97e031736e546 100644 --- a/tests/components/pilight/test_sensor.py +++ b/tests/components/pilight/test_sensor.py @@ -4,8 +4,7 @@ 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 diff --git a/tests/components/pjlink/test_media_player.py b/tests/components/pjlink/test_media_player.py index d44bc94229019..b2f250103ad28 100644 --- a/tests/components/pjlink/test_media_player.py +++ b/tests/components/pjlink/test_media_player.py @@ -9,7 +9,7 @@ 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 diff --git a/tests/components/plant/test_init.py b/tests/components/plant/test_init.py index d173544284d5d..0f79ade2df503 100644 --- a/tests/components/plant/test_init.py +++ b/tests/components/plant/test_init.py @@ -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, diff --git a/tests/components/plex/test_init.py b/tests/components/plex/test_init.py index a1a05db9d9a13..b8dc42d54723b 100644 --- a/tests/components/plex/test_init.py +++ b/tests/components/plex/test_init.py @@ -10,7 +10,7 @@ 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, diff --git a/tests/components/python_script/test_init.py b/tests/components/python_script/test_init.py index 504d61a0d8d13..463d69975b497 100644 --- a/tests/components/python_script/test_init.py +++ b/tests/components/python_script/test_init.py @@ -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"} diff --git a/tests/components/recorder/test_history.py b/tests/components/recorder/test_history.py index 04204cf84a684..ebcb0522e72a4 100644 --- a/tests/components/recorder/test_history.py +++ b/tests/components/recorder/test_history.py @@ -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"] diff --git a/tests/components/recorder/test_history_db_schema_30.py b/tests/components/recorder/test_history_db_schema_30.py index 0aaf1ebb094b2..2d0b3398a87b8 100644 --- a/tests/components/recorder/test_history_db_schema_30.py +++ b/tests/components/recorder/test_history_db_schema_30.py @@ -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( diff --git a/tests/components/recorder/test_history_db_schema_32.py b/tests/components/recorder/test_history_db_schema_32.py index 9bb6d70b1258e..5acf07b0604de 100644 --- a/tests/components/recorder/test_history_db_schema_32.py +++ b/tests/components/recorder/test_history_db_schema_32.py @@ -408,13 +408,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( diff --git a/tests/components/recorder/test_history_db_schema_42.py b/tests/components/recorder/test_history_db_schema_42.py index a72345e71bd46..e342799c3a8f8 100644 --- a/tests/components/recorder/test_history_db_schema_42.py +++ b/tests/components/recorder/test_history_db_schema_42.py @@ -638,13 +638,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"] diff --git a/tests/components/remote/test_device_action.py b/tests/components/remote/test_device_action.py index 09c6884387296..50a859af446bc 100644 --- a/tests/components/remote/test_device_action.py +++ b/tests/components/remote/test_device_action.py @@ -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.remote import DOMAIN from homeassistant.const import EntityCategory diff --git a/tests/components/remote/test_device_condition.py b/tests/components/remote/test_device_condition.py index e7826f4952c22..edfa7c5adf935 100644 --- a/tests/components/remote/test_device_condition.py +++ b/tests/components/remote/test_device_condition.py @@ -6,7 +6,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.remote import DOMAIN from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory diff --git a/tests/components/remote/test_device_trigger.py b/tests/components/remote/test_device_trigger.py index b77d971e9a60e..1f80843be9a79 100644 --- a/tests/components/remote/test_device_trigger.py +++ b/tests/components/remote/test_device_trigger.py @@ -5,7 +5,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.remote import DOMAIN from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory diff --git a/tests/components/remote/test_init.py b/tests/components/remote/test_init.py index 15fbb1174c67e..575e69015fec6 100644 --- a/tests/components/remote/test_init.py +++ b/tests/components/remote/test_init.py @@ -2,7 +2,7 @@ import pytest -import homeassistant.components.remote as remote +from homeassistant.components import remote from homeassistant.components.remote import ( ATTR_ALTERNATIVE, ATTR_COMMAND, diff --git a/tests/components/rest/test_notify.py b/tests/components/rest/test_notify.py index 9f47e74c5350a..9731388a26ec9 100644 --- a/tests/components/rest/test_notify.py +++ b/tests/components/rest/test_notify.py @@ -5,7 +5,7 @@ import respx from homeassistant import config as hass_config -import homeassistant.components.notify as notify +from homeassistant.components import notify from homeassistant.components.rest import DOMAIN from homeassistant.const import SERVICE_RELOAD from homeassistant.core import HomeAssistant diff --git a/tests/components/rfxtrx/test_device_action.py b/tests/components/rfxtrx/test_device_action.py index a717fcf35d68d..c678f2dfc62f7 100644 --- a/tests/components/rfxtrx/test_device_action.py +++ b/tests/components/rfxtrx/test_device_action.py @@ -8,7 +8,7 @@ from pytest_unordered import unordered import RFXtrx -import homeassistant.components.automation as automation +from homeassistant.components import automation from homeassistant.components.device_automation import DeviceAutomationType from homeassistant.components.rfxtrx import DOMAIN from homeassistant.core import HomeAssistant diff --git a/tests/components/rfxtrx/test_device_trigger.py b/tests/components/rfxtrx/test_device_trigger.py index 7d24ec3ff6a4f..629ff897eb792 100644 --- a/tests/components/rfxtrx/test_device_trigger.py +++ b/tests/components/rfxtrx/test_device_trigger.py @@ -7,7 +7,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.rfxtrx import DOMAIN from homeassistant.core import HomeAssistant diff --git a/tests/components/ring/test_init.py b/tests/components/ring/test_init.py index ba5dd03ba9c59..3ca686c37a473 100644 --- a/tests/components/ring/test_init.py +++ b/tests/components/ring/test_init.py @@ -7,7 +7,7 @@ import requests_mock from ring_doorbell import AuthenticationError, RingError, RingTimeout -import homeassistant.components.ring as ring +from homeassistant.components import ring from homeassistant.components.ring import DOMAIN from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntryState from homeassistant.core import HomeAssistant diff --git a/tests/components/sensor/test_device_condition.py b/tests/components/sensor/test_device_condition.py index b633c74420522..08de630f02572 100644 --- a/tests/components/sensor/test_device_condition.py +++ b/tests/components/sensor/test_device_condition.py @@ -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.sensor import ( ATTR_STATE_CLASS, diff --git a/tests/components/sensor/test_device_trigger.py b/tests/components/sensor/test_device_trigger.py index 98bea960fcc13..bb7337c014456 100644 --- a/tests/components/sensor/test_device_trigger.py +++ b/tests/components/sensor/test_device_trigger.py @@ -5,7 +5,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.sensor import ( ATTR_STATE_CLASS, diff --git a/tests/components/smtp/test_notify.py b/tests/components/smtp/test_notify.py index b27a7c2d863ed..dd51cf1599226 100644 --- a/tests/components/smtp/test_notify.py +++ b/tests/components/smtp/test_notify.py @@ -7,7 +7,7 @@ import pytest from homeassistant import config as hass_config -import homeassistant.components.notify as notify +from homeassistant.components import notify from homeassistant.components.smtp.const import DOMAIN from homeassistant.components.smtp.notify import MailNotificationService from homeassistant.const import SERVICE_RELOAD diff --git a/tests/components/snips/test_init.py b/tests/components/snips/test_init.py index 9590473f218b0..89ee211b38f44 100644 --- a/tests/components/snips/test_init.py +++ b/tests/components/snips/test_init.py @@ -7,7 +7,7 @@ import voluptuous as vol from homeassistant.bootstrap import async_setup_component -import homeassistant.components.snips as snips +from homeassistant.components import snips from homeassistant.core import HomeAssistant from homeassistant.helpers.intent import ServiceIntentHandler, async_register diff --git a/tests/components/statsd/test_init.py b/tests/components/statsd/test_init.py index e24909e3f534a..f9222e4bacfb2 100644 --- a/tests/components/statsd/test_init.py +++ b/tests/components/statsd/test_init.py @@ -6,7 +6,7 @@ import pytest import voluptuous as vol -import homeassistant.components.statsd as statsd +from homeassistant.components import statsd from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component diff --git a/tests/components/sun/test_trigger.py b/tests/components/sun/test_trigger.py index f7bdb5eb17bc4..50e070a4f68b8 100644 --- a/tests/components/sun/test_trigger.py +++ b/tests/components/sun/test_trigger.py @@ -5,8 +5,7 @@ from freezegun import freeze_time import pytest -from homeassistant.components import sun -import homeassistant.components.automation as automation +from homeassistant.components import automation, sun from homeassistant.const import ( ATTR_ENTITY_ID, ENTITY_MATCH_ALL, diff --git a/tests/components/switch/test_device_action.py b/tests/components/switch/test_device_action.py index c35f7261afc76..9ad656bcc2b95 100644 --- a/tests/components/switch/test_device_action.py +++ b/tests/components/switch/test_device_action.py @@ -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.switch import DOMAIN from homeassistant.const import EntityCategory diff --git a/tests/components/switch/test_device_condition.py b/tests/components/switch/test_device_condition.py index d69d8a547aa2c..e351daf2a5bac 100644 --- a/tests/components/switch/test_device_condition.py +++ b/tests/components/switch/test_device_condition.py @@ -6,7 +6,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.switch import DOMAIN from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory diff --git a/tests/components/switch/test_device_trigger.py b/tests/components/switch/test_device_trigger.py index 874210a32bc78..58803b0c6acbf 100644 --- a/tests/components/switch/test_device_trigger.py +++ b/tests/components/switch/test_device_trigger.py @@ -5,7 +5,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.switch import DOMAIN from homeassistant.const import STATE_OFF, STATE_ON, EntityCategory diff --git a/tests/components/tag/test_trigger.py b/tests/components/tag/test_trigger.py index 53c511b8594d1..a034334508f28 100644 --- a/tests/components/tag/test_trigger.py +++ b/tests/components/tag/test_trigger.py @@ -2,7 +2,7 @@ import pytest -import homeassistant.components.automation as automation +from homeassistant.components import automation from homeassistant.components.tag import async_scan_tag from homeassistant.components.tag.const import DEVICE_ID, DOMAIN, TAG_ID from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF diff --git a/tests/components/tasmota/test_device_trigger.py b/tests/components/tasmota/test_device_trigger.py index a5d30814b3850..8d299a272f747 100644 --- a/tests/components/tasmota/test_device_trigger.py +++ b/tests/components/tasmota/test_device_trigger.py @@ -8,7 +8,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.tasmota import _LOGGER from homeassistant.components.tasmota.const import DEFAULT_PREFIX, DOMAIN diff --git a/tests/components/telegram/test_notify.py b/tests/components/telegram/test_notify.py index ee13d8dc47c0a..e1daf4da07449 100644 --- a/tests/components/telegram/test_notify.py +++ b/tests/components/telegram/test_notify.py @@ -3,7 +3,7 @@ from unittest.mock import patch from homeassistant import config as hass_config -import homeassistant.components.notify as notify +from homeassistant.components import notify from homeassistant.components.telegram import DOMAIN from homeassistant.const import SERVICE_RELOAD from homeassistant.core import HomeAssistant diff --git a/tests/components/template/test_light.py b/tests/components/template/test_light.py index a40f093a573ed..0dfbc0f833d89 100644 --- a/tests/components/template/test_light.py +++ b/tests/components/template/test_light.py @@ -2,7 +2,7 @@ import pytest -import homeassistant.components.light as light +from homeassistant.components import light from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, diff --git a/tests/components/template/test_trigger.py b/tests/components/template/test_trigger.py index db7cd3a2471e0..0d7d765b98833 100644 --- a/tests/components/template/test_trigger.py +++ b/tests/components/template/test_trigger.py @@ -6,7 +6,7 @@ from freezegun.api import FrozenDateTimeFactory import pytest -import homeassistant.components.automation as automation +from homeassistant.components import automation from homeassistant.components.template import trigger as template_trigger from homeassistant.const import ( ATTR_ENTITY_ID, diff --git a/tests/components/text/test_device_action.py b/tests/components/text/test_device_action.py index 6a0e095855831..29e030b034e06 100644 --- a/tests/components/text/test_device_action.py +++ b/tests/components/text/test_device_action.py @@ -4,7 +4,7 @@ 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.text import DOMAIN, device_action from homeassistant.const import EntityCategory diff --git a/tests/components/universal/test_media_player.py b/tests/components/universal/test_media_player.py index 9df9247900f59..008f7aa516280 100644 --- a/tests/components/universal/test_media_player.py +++ b/tests/components/universal/test_media_player.py @@ -7,12 +7,9 @@ from voluptuous.error import MultipleInvalid from homeassistant import config as hass_config -import homeassistant.components.input_number as input_number -import homeassistant.components.input_select as input_select -import homeassistant.components.media_player as media_player +from homeassistant.components import input_number, input_select, media_player, switch from homeassistant.components.media_player import MediaClass, MediaPlayerEntityFeature from homeassistant.components.media_player.browse_media import BrowseMedia -import homeassistant.components.switch as switch import homeassistant.components.universal.media_player as universal from homeassistant.const import ( SERVICE_RELOAD, diff --git a/tests/components/update/test_device_trigger.py b/tests/components/update/test_device_trigger.py index 31a9ee7b36eb0..1ffd295bbc9d1 100644 --- a/tests/components/update/test_device_trigger.py +++ b/tests/components/update/test_device_trigger.py @@ -5,7 +5,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.update import DOMAIN from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON, EntityCategory diff --git a/tests/components/vacuum/test_device_action.py b/tests/components/vacuum/test_device_action.py index fe5b2814a33cb..fec2ca1bf129a 100644 --- a/tests/components/vacuum/test_device_action.py +++ b/tests/components/vacuum/test_device_action.py @@ -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.vacuum import DOMAIN from homeassistant.const import EntityCategory diff --git a/tests/components/vacuum/test_device_condition.py b/tests/components/vacuum/test_device_condition.py index f8d1368a163e8..850c69c17577c 100644 --- a/tests/components/vacuum/test_device_condition.py +++ b/tests/components/vacuum/test_device_condition.py @@ -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.vacuum import ( DOMAIN, diff --git a/tests/components/vacuum/test_device_trigger.py b/tests/components/vacuum/test_device_trigger.py index 831d6807b8c9d..b2273d905c17f 100644 --- a/tests/components/vacuum/test_device_trigger.py +++ b/tests/components/vacuum/test_device_trigger.py @@ -5,7 +5,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.vacuum import DOMAIN, STATE_CLEANING, STATE_DOCKED from homeassistant.const import EntityCategory diff --git a/tests/components/water_heater/test_device_action.py b/tests/components/water_heater/test_device_action.py index d456fa7be71a5..e08721d3e10ca 100644 --- a/tests/components/water_heater/test_device_action.py +++ b/tests/components/water_heater/test_device_action.py @@ -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.water_heater import DOMAIN from homeassistant.const import EntityCategory diff --git a/tests/components/yandex_transport/test_sensor.py b/tests/components/yandex_transport/test_sensor.py index d302ce17a269c..5ad9fa92c39f4 100644 --- a/tests/components/yandex_transport/test_sensor.py +++ b/tests/components/yandex_transport/test_sensor.py @@ -5,7 +5,7 @@ import pytest -import homeassistant.components.sensor as sensor +from homeassistant.components import sensor from homeassistant.const import CONF_NAME from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component diff --git a/tests/components/zha/conftest.py b/tests/components/zha/conftest.py index b1ac22d544d3a..254cf13c556ad 100644 --- a/tests/components/zha/conftest.py +++ b/tests/components/zha/conftest.py @@ -546,6 +546,5 @@ def _storage(entity_id, state, attributes={}): } ], } - return return _storage diff --git a/tests/components/zha/test_alarm_control_panel.py b/tests/components/zha/test_alarm_control_panel.py index 18065420e584a..8d3bd76ef610b 100644 --- a/tests/components/zha/test_alarm_control_panel.py +++ b/tests/components/zha/test_alarm_control_panel.py @@ -3,8 +3,8 @@ from unittest.mock import AsyncMock, call, patch, sentinel import pytest -import zigpy.profiles.zha as zha -import zigpy.zcl.clusters.security as security +from zigpy.profiles import zha +from zigpy.zcl.clusters import security import zigpy.zcl.foundation as zcl_f from homeassistant.components.alarm_control_panel import DOMAIN as ALARM_DOMAIN diff --git a/tests/components/zha/test_binary_sensor.py b/tests/components/zha/test_binary_sensor.py index 18e78ae7e5776..bd9262a41ce09 100644 --- a/tests/components/zha/test_binary_sensor.py +++ b/tests/components/zha/test_binary_sensor.py @@ -4,9 +4,7 @@ import pytest import zigpy.profiles.zha -import zigpy.zcl.clusters.general as general -import zigpy.zcl.clusters.measurement as measurement -import zigpy.zcl.clusters.security as security +from zigpy.zcl.clusters import general, measurement, security from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNAVAILABLE, Platform from homeassistant.core import HomeAssistant diff --git a/tests/components/zha/test_button.py b/tests/components/zha/test_button.py index 4c0c68458857a..97aaf2bd871b7 100644 --- a/tests/components/zha/test_button.py +++ b/tests/components/zha/test_button.py @@ -15,13 +15,12 @@ from zhaquirks.tuya.ts0601_valve import ParksideTuyaValveManufCluster from zigpy.const import SIG_EP_PROFILE from zigpy.exceptions import ZigbeeException -import zigpy.profiles.zha as zha +from zigpy.profiles import zha from zigpy.quirks import CustomCluster, CustomDevice from zigpy.quirks.v2 import add_to_registry_v2 import zigpy.types as t -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import general, security from zigpy.zcl.clusters.manufacturer_specific import ManufacturerSpecificCluster -import zigpy.zcl.clusters.security as security import zigpy.zcl.foundation as zcl_f from homeassistant.components.button import DOMAIN, SERVICE_PRESS, ButtonDeviceClass diff --git a/tests/components/zha/test_cluster_handlers.py b/tests/components/zha/test_cluster_handlers.py index 60c958f20febd..b8fbd071a6da8 100644 --- a/tests/components/zha/test_cluster_handlers.py +++ b/tests/components/zha/test_cluster_handlers.py @@ -19,7 +19,7 @@ from zigpy.zcl.clusters import CLUSTERS_BY_ID import zigpy.zdo.types as zdo_t -import homeassistant.components.zha.core.cluster_handlers as cluster_handlers +from homeassistant.components.zha.core import cluster_handlers, registries from homeassistant.components.zha.core.cluster_handlers.lighting import ( ColorClusterHandler, ) @@ -27,7 +27,6 @@ from homeassistant.components.zha.core.device import ZHADevice from homeassistant.components.zha.core.endpoint import Endpoint from homeassistant.components.zha.core.helpers import get_zha_gateway -import homeassistant.components.zha.core.registries as registries from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError diff --git a/tests/components/zha/test_cover.py b/tests/components/zha/test_cover.py index a1b320097e829..5f6dac885f230 100644 --- a/tests/components/zha/test_cover.py +++ b/tests/components/zha/test_cover.py @@ -6,8 +6,7 @@ import pytest import zigpy.profiles.zha import zigpy.types -import zigpy.zcl.clusters.closures as closures -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import closures, general import zigpy.zcl.foundation as zcl_f from homeassistant.components.cover import ( diff --git a/tests/components/zha/test_device.py b/tests/components/zha/test_device.py index 48eecdd87d4db..289442b34664c 100644 --- a/tests/components/zha/test_device.py +++ b/tests/components/zha/test_device.py @@ -9,7 +9,7 @@ import pytest import zigpy.profiles.zha import zigpy.types -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import general import zigpy.zdo.types as zdo_t from homeassistant.components.zha.core.const import ( diff --git a/tests/components/zha/test_device_action.py b/tests/components/zha/test_device_action.py index a7b66dea8d704..bc478532859ac 100644 --- a/tests/components/zha/test_device_action.py +++ b/tests/components/zha/test_device_action.py @@ -6,11 +6,10 @@ from pytest_unordered import unordered from zhaquirks.inovelli.VZM31SN import InovelliVZM31SNv11 import zigpy.profiles.zha -import zigpy.zcl.clusters.general as general -import zigpy.zcl.clusters.security as security +from zigpy.zcl.clusters import general, security import zigpy.zcl.foundation as zcl_f -import homeassistant.components.automation as automation +from homeassistant.components import automation from homeassistant.components.device_automation import DeviceAutomationType from homeassistant.components.zha import DOMAIN from homeassistant.const import Platform diff --git a/tests/components/zha/test_device_tracker.py b/tests/components/zha/test_device_tracker.py index 89ea788e5ef1a..64360c8b2ff05 100644 --- a/tests/components/zha/test_device_tracker.py +++ b/tests/components/zha/test_device_tracker.py @@ -6,7 +6,7 @@ import pytest import zigpy.profiles.zha -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import general from homeassistant.components.device_tracker import SourceType from homeassistant.components.zha.core.registries import ( diff --git a/tests/components/zha/test_device_trigger.py b/tests/components/zha/test_device_trigger.py index f9141795ef117..2cb7c8c94e755 100644 --- a/tests/components/zha/test_device_trigger.py +++ b/tests/components/zha/test_device_trigger.py @@ -7,9 +7,9 @@ import pytest from zigpy.application import ControllerApplication import zigpy.profiles.zha -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import general -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, diff --git a/tests/components/zha/test_diagnostics.py b/tests/components/zha/test_diagnostics.py index 3493d772a6ffc..50b07b70e8d7f 100644 --- a/tests/components/zha/test_diagnostics.py +++ b/tests/components/zha/test_diagnostics.py @@ -3,8 +3,8 @@ from unittest.mock import patch import pytest -import zigpy.profiles.zha as zha -import zigpy.zcl.clusters.security as security +from zigpy.profiles import zha +from zigpy.zcl.clusters import security from homeassistant.components.diagnostics import REDACTED from homeassistant.components.zha.core.device import ZHADevice diff --git a/tests/components/zha/test_discover.py b/tests/components/zha/test_discover.py index c32b9252f4dca..16733d6910908 100644 --- a/tests/components/zha/test_discover.py +++ b/tests/components/zha/test_discover.py @@ -40,7 +40,7 @@ import zigpy.zcl.clusters.security import zigpy.zcl.foundation as zcl_f -import homeassistant.components.zha.core.cluster_handlers as cluster_handlers +from homeassistant.components.zha.core import cluster_handlers import homeassistant.components.zha.core.const as zha_const from homeassistant.components.zha.core.device import ZHADevice import homeassistant.components.zha.core.discovery as disc diff --git a/tests/components/zha/test_gateway.py b/tests/components/zha/test_gateway.py index 182cc2c475299..d090ac8aba044 100644 --- a/tests/components/zha/test_gateway.py +++ b/tests/components/zha/test_gateway.py @@ -5,10 +5,9 @@ import pytest from zigpy.application import ControllerApplication -import zigpy.profiles.zha as zha +from zigpy.profiles import zha import zigpy.types -import zigpy.zcl.clusters.general as general -import zigpy.zcl.clusters.lighting as lighting +from zigpy.zcl.clusters import general, lighting import zigpy.zdo.types from homeassistant.components.zha.core.gateway import ZHAGateway diff --git a/tests/components/zha/test_helpers.py b/tests/components/zha/test_helpers.py index fed8fe5bb912c..0615fefd64449 100644 --- a/tests/components/zha/test_helpers.py +++ b/tests/components/zha/test_helpers.py @@ -6,11 +6,10 @@ import pytest import voluptuous_serialize -import zigpy.profiles.zha as zha +from zigpy.profiles import zha from zigpy.quirks.v2.homeassistant import UnitOfPower as QuirksUnitOfPower from zigpy.types.basic import uint16_t -import zigpy.zcl.clusters.general as general -import zigpy.zcl.clusters.lighting as lighting +from zigpy.zcl.clusters import general, lighting from homeassistant.components.zha.core.helpers import ( cluster_command_schema_to_vol_schema, diff --git a/tests/components/zha/test_light.py b/tests/components/zha/test_light.py index a6473c6007ce4..762ab14cbaa26 100644 --- a/tests/components/zha/test_light.py +++ b/tests/components/zha/test_light.py @@ -4,9 +4,8 @@ from unittest.mock import AsyncMock, call, patch, sentinel import pytest -import zigpy.profiles.zha as zha -import zigpy.zcl.clusters.general as general -import zigpy.zcl.clusters.lighting as lighting +from zigpy.profiles import zha +from zigpy.zcl.clusters import general, lighting import zigpy.zcl.foundation as zcl_f from homeassistant.components.light import ( @@ -1631,10 +1630,7 @@ async def test_zha_group_light_entity( device_2_entity_id = find_entity_id(Platform.LIGHT, device_light_2, hass) device_3_entity_id = find_entity_id(Platform.LIGHT, device_light_3, hass) - assert ( - device_1_entity_id != device_2_entity_id - and device_1_entity_id != device_3_entity_id - ) + assert device_1_entity_id not in (device_2_entity_id, device_3_entity_id) assert device_2_entity_id != device_3_entity_id group_entity_id = async_find_group_entity_id(hass, Platform.LIGHT, zha_group) diff --git a/tests/components/zha/test_lock.py b/tests/components/zha/test_lock.py index 52b1d891dfdda..b16d7a31828d1 100644 --- a/tests/components/zha/test_lock.py +++ b/tests/components/zha/test_lock.py @@ -4,8 +4,7 @@ import pytest import zigpy.profiles.zha -import zigpy.zcl.clusters.closures as closures -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import closures, general import zigpy.zcl.foundation as zcl_f from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN diff --git a/tests/components/zha/test_logbook.py b/tests/components/zha/test_logbook.py index 889c73362ae2d..317e10346f008 100644 --- a/tests/components/zha/test_logbook.py +++ b/tests/components/zha/test_logbook.py @@ -4,7 +4,7 @@ import pytest import zigpy.profiles.zha -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import general from homeassistant.components.zha.core.const import ZHA_EVENT from homeassistant.const import CONF_DEVICE_ID, CONF_UNIQUE_ID, Platform diff --git a/tests/components/zha/test_number.py b/tests/components/zha/test_number.py index a9fb3dd950964..6bb1703a22916 100644 --- a/tests/components/zha/test_number.py +++ b/tests/components/zha/test_number.py @@ -5,8 +5,7 @@ import pytest from zigpy.exceptions import ZigbeeException from zigpy.profiles import zha -import zigpy.zcl.clusters.general as general -import zigpy.zcl.clusters.lighting as lighting +from zigpy.zcl.clusters import general, lighting import zigpy.zcl.foundation as zcl_f from homeassistant.components.number import DOMAIN as NUMBER_DOMAIN diff --git a/tests/components/zha/test_registries.py b/tests/components/zha/test_registries.py index 29020aa4313c4..279975a260fc2 100644 --- a/tests/components/zha/test_registries.py +++ b/tests/components/zha/test_registries.py @@ -9,8 +9,8 @@ import zigpy.quirks as zigpy_quirks from homeassistant.components.zha.binary_sensor import IASZone +from homeassistant.components.zha.core import registries from homeassistant.components.zha.core.const import ATTR_QUIRK_ID -import homeassistant.components.zha.core.registries as registries from homeassistant.helpers import entity_registry as er if typing.TYPE_CHECKING: diff --git a/tests/components/zha/test_select.py b/tests/components/zha/test_select.py index bb1c5ca270a3c..97aed05dcd37d 100644 --- a/tests/components/zha/test_select.py +++ b/tests/components/zha/test_select.py @@ -11,13 +11,12 @@ PROFILE_ID, ) from zigpy.const import SIG_EP_PROFILE -import zigpy.profiles.zha as zha +from zigpy.profiles import zha from zigpy.quirks import CustomCluster, CustomDevice from zigpy.quirks.v2 import CustomDeviceV2, add_to_registry_v2 import zigpy.types as t -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import general, security from zigpy.zcl.clusters.manufacturer_specific import ManufacturerSpecificCluster -import zigpy.zcl.clusters.security as security from homeassistant.components.zha.select import AqaraMotionSensitivities from homeassistant.const import STATE_UNKNOWN, EntityCategory, Platform diff --git a/tests/components/zha/test_sensor.py b/tests/components/zha/test_sensor.py index 8d0ef8107e39b..59da8332b27af 100644 --- a/tests/components/zha/test_sensor.py +++ b/tests/components/zha/test_sensor.py @@ -672,7 +672,6 @@ def _storage(entity_id, uom, state): } ], } - return return _storage diff --git a/tests/components/zha/test_siren.py b/tests/components/zha/test_siren.py index f5486d91c0f57..652955ef98d92 100644 --- a/tests/components/zha/test_siren.py +++ b/tests/components/zha/test_siren.py @@ -5,10 +5,9 @@ import pytest from zigpy.const import SIG_EP_PROFILE -import zigpy.profiles.zha as zha +from zigpy.profiles import zha import zigpy.zcl -import zigpy.zcl.clusters.general as general -import zigpy.zcl.clusters.security as security +from zigpy.zcl.clusters import general, security import zigpy.zcl.foundation as zcl_f from homeassistant.components.siren import ( diff --git a/tests/components/zha/test_switch.py b/tests/components/zha/test_switch.py index 644062198f9ad..c8c2842c40039 100644 --- a/tests/components/zha/test_switch.py +++ b/tests/components/zha/test_switch.py @@ -11,12 +11,11 @@ PROFILE_ID, ) from zigpy.exceptions import ZigbeeException -import zigpy.profiles.zha as zha +from zigpy.profiles import zha from zigpy.quirks import _DEVICE_REGISTRY, CustomCluster, CustomDevice from zigpy.quirks.v2 import CustomDeviceV2, add_to_registry_v2 import zigpy.types as t -import zigpy.zcl.clusters.closures as closures -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import closures, general from zigpy.zcl.clusters.manufacturer_specific import ManufacturerSpecificCluster import zigpy.zcl.foundation as zcl_f diff --git a/tests/components/zha/test_update.py b/tests/components/zha/test_update.py index 854c08985ac58..60cd5bf9ff966 100644 --- a/tests/components/zha/test_update.py +++ b/tests/components/zha/test_update.py @@ -7,10 +7,10 @@ from zigpy.ota import OtaImageWithMetadata import zigpy.ota.image as firmware from zigpy.ota.providers import BaseOtaImageMetadata -import zigpy.profiles.zha as zha +from zigpy.profiles import zha import zigpy.types as t -import zigpy.zcl.clusters.general as general -import zigpy.zcl.foundation as foundation +from zigpy.zcl import foundation +from zigpy.zcl.clusters import general from homeassistant.components.homeassistant import ( DOMAIN as HA_DOMAIN, diff --git a/tests/components/zha/test_websocket_api.py b/tests/components/zha/test_websocket_api.py index 623d7acf60286..927da4ed2c041 100644 --- a/tests/components/zha/test_websocket_api.py +++ b/tests/components/zha/test_websocket_api.py @@ -15,9 +15,8 @@ import zigpy.types from zigpy.types.named import EUI64 import zigpy.util -import zigpy.zcl.clusters.general as general +from zigpy.zcl.clusters import general, security from zigpy.zcl.clusters.general import Groups -import zigpy.zcl.clusters.security as security import zigpy.zdo.types as zdo_types from homeassistant.components.websocket_api import const diff --git a/tests/helpers/test_condition.py b/tests/helpers/test_condition.py index 1b279fd0f5153..701bc3427601e 100644 --- a/tests/helpers/test_condition.py +++ b/tests/helpers/test_condition.py @@ -8,7 +8,7 @@ import pytest import voluptuous as vol -import homeassistant.components.automation as automation +from homeassistant.components import automation from homeassistant.components.sensor import SensorDeviceClass from homeassistant.const import ( ATTR_DEVICE_CLASS, diff --git a/tests/helpers/test_registry.py b/tests/helpers/test_registry.py index 46b04b05fe348..0218267452a5d 100644 --- a/tests/helpers/test_registry.py +++ b/tests/helpers/test_registry.py @@ -21,10 +21,10 @@ def __init__(self, hass: HomeAssistant) -> None: self._store = storage.Store(hass, 1, "test") self.save_calls = 0 - def _data_to_save(self) -> None: + def _data_to_save(self) -> dict[str, Any]: """Return data of registry to save.""" self.save_calls += 1 - return None + return {} @pytest.mark.parametrize( diff --git a/tests/helpers/test_script.py b/tests/helpers/test_script.py index 86fb84eb582df..53499c4f88cff 100644 --- a/tests/helpers/test_script.py +++ b/tests/helpers/test_script.py @@ -16,7 +16,7 @@ # Otherwise can't test just this file (import order issue) from homeassistant import config_entries, exceptions -import homeassistant.components.scene as scene +from homeassistant.components import scene from homeassistant.const import ( ATTR_ENTITY_ID, CONF_DEVICE_ID, diff --git a/tests/helpers/test_sun.py b/tests/helpers/test_sun.py index b6dc1616a481b..da436d799aa56 100644 --- a/tests/helpers/test_sun.py +++ b/tests/helpers/test_sun.py @@ -7,7 +7,7 @@ from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET from homeassistant.core import HomeAssistant -import homeassistant.helpers.sun as sun +from homeassistant.helpers import sun import homeassistant.util.dt as dt_util diff --git a/tests/ruff.toml b/tests/ruff.toml index 1a8876b917146..b88a5f1689ed3 100644 --- a/tests/ruff.toml +++ b/tests/ruff.toml @@ -5,7 +5,6 @@ extend = "../pyproject.toml" extend-ignore = [ "PLC", # pylint - "PLR", # pylint "B904", # Use raise from to specify exception cause "N815", # Variable {name} in class scope should not be mixedCase ] diff --git a/tests/scripts/test_check_config.py b/tests/scripts/test_check_config.py index a77e5bf504a44..96d63206cfc20 100644 --- a/tests/scripts/test_check_config.py +++ b/tests/scripts/test_check_config.py @@ -6,7 +6,7 @@ import pytest from homeassistant.config import YAML_CONFIG_FILE -import homeassistant.scripts.check_config as check_config +from homeassistant.scripts import check_config from tests.common import get_test_config_dir diff --git a/tests/scripts/test_init.py b/tests/scripts/test_init.py index 44edece181225..002ade2baeff0 100644 --- a/tests/scripts/test_init.py +++ b/tests/scripts/test_init.py @@ -2,7 +2,7 @@ from unittest.mock import patch -import homeassistant.scripts as scripts +from homeassistant import scripts @patch("homeassistant.scripts.get_default_config_dir", return_value="/default") diff --git a/tests/test_config.py b/tests/test_config.py index c20e28225927b..49cc2bb573f37 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -39,8 +39,11 @@ HomeAssistantError, ) from homeassistant.exceptions import ConfigValidationError -from homeassistant.helpers import config_validation as cv, issue_registry as ir -import homeassistant.helpers.check_config as check_config +from homeassistant.helpers import ( + check_config, + config_validation as cv, + issue_registry as ir, +) from homeassistant.helpers.entity import Entity from homeassistant.helpers.typing import ConfigType from homeassistant.loader import Integration, async_get_integration diff --git a/tests/test_loader.py b/tests/test_loader.py index 4442fe5fd8230..e73029e14e21d 100644 --- a/tests/test_loader.py +++ b/tests/test_loader.py @@ -1349,7 +1349,7 @@ def import_module(name: str) -> Any: modules_without_integration = { k: v for k, v in sys.modules.items() - if k != config_flow_module_name and k != integration.pkg_path + if k not in (config_flow_module_name, integration.pkg_path) } with ( patch.dict( @@ -1737,7 +1737,7 @@ def import_module(name: str) -> Any: modules_without_button = { k: v for k, v in sys.modules.items() - if k != button_module_name and k != integration.pkg_path + if k not in (button_module_name, integration.pkg_path) } with ( patch.dict( diff --git a/tests/util/test_dt.py b/tests/util/test_dt.py index 5716e4e524c18..7ed8154f0338d 100644 --- a/tests/util/test_dt.py +++ b/tests/util/test_dt.py @@ -88,12 +88,6 @@ def test_as_local_with_naive_object() -> None: ) < timedelta(seconds=1) -def test_as_local_with_local_object() -> None: - """Test local with local object.""" - now = dt_util.now() - assert now == now - - def test_as_local_with_utc_object() -> None: """Test local time with UTC object.""" dt_util.set_default_time_zone(dt_util.get_time_zone(TEST_TIME_ZONE)) diff --git a/tests/util/test_package.py b/tests/util/test_package.py index 0e2e9278676c3..2ead327bf10ce 100644 --- a/tests/util/test_package.py +++ b/tests/util/test_package.py @@ -10,7 +10,7 @@ import pytest -import homeassistant.util.package as package +from homeassistant.util import package RESOURCE_DIR = os.path.abspath( os.path.join(os.path.dirname(__file__), "..", "resources") diff --git a/tests/util/yaml/test_init.py b/tests/util/yaml/test_init.py index dba8e9b8017c0..113a348c1d13e 100644 --- a/tests/util/yaml/test_init.py +++ b/tests/util/yaml/test_init.py @@ -16,7 +16,7 @@ from homeassistant.config import YAML_CONFIG_FILE, load_yaml_config_file from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError -import homeassistant.util.yaml as yaml +from homeassistant.util import yaml from homeassistant.util.yaml import loader as yaml_loader from tests.common import extract_stack_to_frame, get_test_config_dir, patch_yaml_files