diff --git a/pyproject.toml b/pyproject.toml index 8eeba78..f5b0aa6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,14 +116,12 @@ asyncio_mode = "auto" [tool.ruff.lint] ignore = [ "ANN401", # Opinioated warning on disallowing dynamically typed expressions - "ANN204", "DTZ005", "PLR0913", "TRY003", "FBT002", "ARG002", "FBT001", - "ANN205", "BLE001", "S110", "S105", diff --git a/src/pysmartthings/api.py b/src/pysmartthings/api.py index 3394cf8..a6e701c 100644 --- a/src/pysmartthings/api.py +++ b/src/pysmartthings/api.py @@ -43,7 +43,9 @@ class Api: __slots__ = ["_api_base", "_session", "_token"] - def __init__(self, session: ClientSession, token: str, *, api_base: str = API_BASE): + def __init__( + self, session: ClientSession, token: str, *, api_base: str = API_BASE + ) -> None: """Create a new API with the given session and token.""" self._session = session self._token = token diff --git a/src/pysmartthings/app.py b/src/pysmartthings/app.py index 4592214..411eb50 100644 --- a/src/pysmartthings/app.py +++ b/src/pysmartthings/app.py @@ -20,7 +20,7 @@ class App: """Define the app class.""" - def __init__(self): + def __init__(self) -> None: """Initialize a new instance of the App class.""" self._app_name = None self._display_name = None @@ -214,7 +214,7 @@ def webhook_public_key(self) -> str: class AppSettings: """Define a SmartThings app settings.""" - def __init__(self, app_id: str): + def __init__(self, app_id: str) -> None: """Create a new instance of the AppSettings class.""" self._app_id = app_id self._settings = {} @@ -275,7 +275,7 @@ async def save(self) -> None: class AppOAuth: """Define the app OAuth settings.""" - def __init__(self, app_id: str): + def __init__(self, app_id: str) -> None: """Initialize a new instance of the OAuth class.""" self._app_id = app_id self._client_name = None @@ -373,7 +373,7 @@ async def settings(self) -> AppSettingsEntity: class AppOAuthClient: """Define an oauth client information.""" - def __init__(self, data: dict | None): + def __init__(self, data: dict | None) -> None: """Create a new instance of the OAuthClient.""" self._client_id = None self._client_secret = None @@ -399,7 +399,7 @@ def client_secret(self) -> str: class AppOAuthClientEntity(AppOAuthClient): """Define an oauth client information details.""" - def __init__(self, api: Api, app_id: str, data: dict | None): + def __init__(self, api: Api, app_id: str, data: dict | None) -> None: """Init the class.""" self._client_details = AppOAuthEntity(api, app_id, None) super().__init__(data) diff --git a/src/pysmartthings/device.py b/src/pysmartthings/device.py index abb9f15..49ac781 100644 --- a/src/pysmartthings/device.py +++ b/src/pysmartthings/device.py @@ -105,7 +105,7 @@ class Command: class Device: """Represents a SmartThings device.""" - def __init__(self): + def __init__(self) -> None: """Initialize a new device.""" self._device_id = None self._name = None @@ -215,7 +215,7 @@ class DeviceStatusBase: def __init__( self, component_id: str, attributes: Mapping[str, Status] | None = None - ): + ) -> None: """Initialize the status class.""" self._attributes = defaultdict(lambda: STATUS_NONE, attributes or {}) self._component_id = component_id @@ -841,7 +841,7 @@ class DeviceEntity(Entity, Device): def __init__( self, api: Api, data: dict | None = None, device_id: str | None = None - ): + ) -> None: """Create a new instance of the DeviceEntity class.""" Entity.__init__(self, api) Device.__init__(self) diff --git a/src/pysmartthings/entity.py b/src/pysmartthings/entity.py index 19629c2..88844ac 100644 --- a/src/pysmartthings/entity.py +++ b/src/pysmartthings/entity.py @@ -8,7 +8,7 @@ class Entity: """Define an entity from the SmartThings API.""" - def __init__(self, api: Api): + def __init__(self, api: Api) -> None: """Initialize a new instance of the entity.""" self._api = api diff --git a/src/pysmartthings/installedapp.py b/src/pysmartthings/installedapp.py index 321b81a..de66e1b 100644 --- a/src/pysmartthings/installedapp.py +++ b/src/pysmartthings/installedapp.py @@ -41,7 +41,7 @@ class InstalledAppStatus(Enum): class InstalledApp: """Define the InstalledApp class.""" - def __init__(self): + def __init__(self) -> None: """Create a new instance of the InstalledApp class.""" self._installed_app_id = None self._installed_app_type = InstalledAppType.UNKNOWN diff --git a/src/pysmartthings/location.py b/src/pysmartthings/location.py index 4fff85a..3b0ba1e 100644 --- a/src/pysmartthings/location.py +++ b/src/pysmartthings/location.py @@ -14,7 +14,7 @@ class Location: """Represents a SmartThings Location.""" - def __init__(self): + def __init__(self) -> None: """Initialize a new location.""" self._name = None self._location_id = None @@ -89,7 +89,7 @@ class LocationEntity(Entity, Location): def __init__( self, api: Api, data: dict | None = None, location_id: str | None = None - ): + ) -> None: """Create a new instance of the LocationEntity.""" Entity.__init__(self, api) Location.__init__(self) diff --git a/src/pysmartthings/oauthtoken.py b/src/pysmartthings/oauthtoken.py index c3f79fb..859a1d5 100644 --- a/src/pysmartthings/oauthtoken.py +++ b/src/pysmartthings/oauthtoken.py @@ -14,7 +14,7 @@ class OAuthToken: def __init__( self, api: Api, data: dict | None = None, refresh_token: str | None = None - ): + ) -> None: """Create a new instance of the OAuthToken class.""" self._api = api self._access_token = None diff --git a/src/pysmartthings/room.py b/src/pysmartthings/room.py index 98d42fa..251c121 100644 --- a/src/pysmartthings/room.py +++ b/src/pysmartthings/room.py @@ -13,7 +13,7 @@ class Room: """Defines a SmartThings room.""" - def __init__(self): + def __init__(self) -> None: """Initialize the room.""" self._room_id = None self._location_id = None @@ -85,7 +85,7 @@ def __init__( *, location_id: str | None = None, room_id: str | None = None, - ): + ) -> None: """Initialize the room.""" Entity.__init__(self, api) Room.__init__(self) diff --git a/src/pysmartthings/scene.py b/src/pysmartthings/scene.py index 6fa5424..825d87b 100644 --- a/src/pysmartthings/scene.py +++ b/src/pysmartthings/scene.py @@ -13,7 +13,7 @@ class Scene: """Define a scene data entity.""" - def __init__(self): + def __init__(self) -> None: """Create a new instance of the Scene class.""" self._color = None self._icon = None @@ -58,7 +58,7 @@ def scene_id(self) -> str: class SceneEntity(Entity, Scene): """Define a scene entity.""" - def __init__(self, api: Api, data: dict | None = None): + def __init__(self, api: Api, data: dict | None = None) -> None: """Create a new instance of the class.""" Entity.__init__(self, api) Scene.__init__(self) diff --git a/src/pysmartthings/smartthings.py b/src/pysmartthings/smartthings.py index 1d36489..1e4e322 100644 --- a/src/pysmartthings/smartthings.py +++ b/src/pysmartthings/smartthings.py @@ -34,7 +34,7 @@ class SmartThings: __slots__ = ["_service"] - def __init__(self, session: ClientSession, token: str): + def __init__(self, session: ClientSession, token: str) -> None: """Initialize the SmartThingsApi.""" self._service = Api(session, token) diff --git a/src/pysmartthings/subscription.py b/src/pysmartthings/subscription.py index 08d4b78..2c54dd5 100644 --- a/src/pysmartthings/subscription.py +++ b/src/pysmartthings/subscription.py @@ -22,7 +22,7 @@ class SourceType(Enum): class Subscription: """Define the subscription class.""" - def __init__(self): + def __init__(self) -> None: """Initialize a new instance of the subscription class.""" self._subscription_id = None self._installed_app_id = None @@ -205,7 +205,7 @@ def component_id(self, value: str) -> None: class SubscriptionEntity(Entity, Subscription): """Define a subscription entity.""" - def __init__(self, api: Api, data: dict | None = None): + def __init__(self, api: Api, data: dict | None = None) -> None: """Create a new instance of the SubscriptionEntity class.""" Entity.__init__(self, api) Subscription.__init__(self) diff --git a/tests/test_app.py b/tests/test_app.py index f369201..8459356 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -21,7 +21,7 @@ class TestApp: """Define tests for the App class.""" @staticmethod - def test_init(): + def test_init() -> None: """Tests the init function.""" # Arrange/Act app = App() @@ -30,7 +30,7 @@ def test_init(): assert app.lambda_functions is not None @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Tests the apply_data function.""" # Arrange app = App() @@ -54,7 +54,7 @@ def test_apply_data(): assert app.last_updated_date == "2018-12-15T17:07:42Z" @staticmethod - def test_app_name(): + def test_app_name() -> None: """Tests get/set of app_name.""" # Arrange app = App() @@ -66,7 +66,7 @@ def test_app_name(): assert app_name == expected_app_name @staticmethod - def test_app_name_invalid(): + def test_app_name_invalid() -> None: """Tests valid values of app_name.""" # Arrange app = App() @@ -79,7 +79,7 @@ def test_app_name_invalid(): app.app_name = "My Super Cool App" @staticmethod - def test_display_name(): + def test_display_name() -> None: """Tests get/set of display_name.""" # Arrange app = App() @@ -91,7 +91,7 @@ def test_display_name(): assert expected == actual @staticmethod - def test_display_name_invalid(): + def test_display_name_invalid() -> None: """Tests valid values of display_name.""" # Arrange app = App() @@ -104,7 +104,7 @@ def test_display_name_invalid(): app.display_name = "x" * 76 @staticmethod - def test_description(): + def test_description() -> None: """Tests get/set of description.""" # Arrange app = App() @@ -116,7 +116,7 @@ def test_description(): assert expected == actual @staticmethod - def test_description_invalid(): + def test_description_invalid() -> None: """Tests valid values of description.""" # Arrange app = App() @@ -129,7 +129,7 @@ def test_description_invalid(): app.description = "x" * 251 @staticmethod - def test_single_instance(): + def test_single_instance() -> None: """Tests get/set of single_instance.""" # Arrange app = App() @@ -141,7 +141,7 @@ def test_single_instance(): assert expected == actual @staticmethod - def test_app_type_webhook(): + def test_app_type_webhook() -> None: """Tests get/set of app_type to webhook.""" # Arrange app = App() @@ -153,7 +153,7 @@ def test_app_type_webhook(): assert expected == actual @staticmethod - def test_app_type_lambda(): + def test_app_type_lambda() -> None: """Tests get/set of app_type to labmda.""" # Arrange app = App() @@ -165,7 +165,7 @@ def test_app_type_lambda(): assert expected == actual @staticmethod - def test_app_type_invalid(): + def test_app_type_invalid() -> None: """Tests valid values of app_type.""" # Arrange app = App() @@ -178,7 +178,7 @@ def test_app_type_invalid(): app.app_type = "Some type" @staticmethod - def test_lambda_functions(): + def test_lambda_functions() -> None: """Tests get of lambda_functions.""" # Arrange app = App() @@ -190,7 +190,7 @@ def test_lambda_functions(): assert app.lambda_functions @staticmethod - def test_webhook_target_url(): + def test_webhook_target_url() -> None: """Tests get/set of webhook_target_url.""" # Arrange app = App() @@ -206,7 +206,7 @@ class TestAppSettings: """Tests for the AppSettings class.""" @staticmethod - def test_init(): + def test_init() -> None: """Tests the init method.""" # Arrange/Act settings = AppSettings(APP_ID) @@ -214,7 +214,7 @@ def test_init(): assert settings.app_id == APP_ID @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Tests the apply_data method.""" # Arrange data = get_json("app_settings.json") @@ -225,7 +225,7 @@ def test_apply_data(): assert settings.settings["test"] == "test" @staticmethod - def test_to_data(): + def test_to_data() -> None: """Tests the to_data method.""" # Arrange settings = AppSettings(APP_ID) @@ -241,7 +241,7 @@ class TestAppSettingsEntity: @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests data is refreshed.""" # Arrange data = {"settings": {"test2": "test"}} @@ -253,7 +253,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_refresh_no_app_id(api): + async def test_refresh_no_app_id(api) -> None: """Tests refresh when there's no app id.""" # Arrange settings = AppSettingsEntity(api, None) @@ -263,7 +263,7 @@ async def test_refresh_no_app_id(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests the save function.""" # Arrange data = {"settings": {"test": "test"}} @@ -275,7 +275,7 @@ async def test_save(api): @staticmethod @pytest.mark.asyncio - async def test_save_no_app_id(api): + async def test_save_no_app_id(api) -> None: """Tests save when there's no app id.""" # Arrange settings = AppSettingsEntity(api, None) @@ -289,7 +289,7 @@ class TestAppEntity: @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests data is refreshed.""" # Arrange data = get_json("apps.json")["items"][0] @@ -303,7 +303,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests updating an entity.""" # Arrange data = get_json("app_get.json") @@ -316,7 +316,7 @@ async def test_save(api): @staticmethod @pytest.mark.asyncio - async def test_oauth(api): + async def test_oauth(api) -> None: """Tests the oauth method.""" # Arrange data = get_json("app_get.json") @@ -330,7 +330,7 @@ async def test_oauth(api): @staticmethod @pytest.mark.asyncio - async def test_settings(api): + async def test_settings(api) -> None: """Tests the settings method.""" # Arrange data = get_json("app_get.json") @@ -345,7 +345,7 @@ class TestOAuth: """Tests for the OAuth class.""" @staticmethod - def test_init(): + def test_init() -> None: """Tests the initialization.""" # Arrange app_id = "5c03e518-118a-44cb-85ad-7877d0b302e4" @@ -356,7 +356,7 @@ def test_init(): assert oauth.scope is not None @staticmethod - def test_client_name(): + def test_client_name() -> None: """Tests get/set of client name.""" # Arrange oauth = AppOAuth("5c03e518-118a-44cb-85ad-7877d0b302e4") @@ -368,7 +368,7 @@ def test_client_name(): assert actual == expected @staticmethod - def test_client_name_invalid(): + def test_client_name_invalid() -> None: """Tests setting an invalid client name.""" # Arrange oauth = AppOAuth("5c03e518-118a-44cb-85ad-7877d0b302e4") @@ -382,7 +382,7 @@ class TestOAuthEntity: @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" # Arrange entity = AppOAuthEntity(api, "c6cde2b0-203e-44cf-a510-3b3ed4706996", None) @@ -394,7 +394,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests the refresh method.""" # Arrange entity = AppOAuthEntity(api, "c6cde2b0-203e-44cf-a510-3b3ed4706996", None) diff --git a/tests/test_device.py b/tests/test_device.py index 77ea633..f9e440d 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -20,7 +20,7 @@ class TestDevice: """Tests for the Device class.""" @staticmethod - def test_init(): + def test_init() -> None: """Tests whether the Device class initializes correctly.""" # Arrange/Act device = Device() @@ -30,7 +30,7 @@ def test_init(): assert not device.components @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Tests the apply data method.""" # Arrange data = get_json("device.json") @@ -63,7 +63,7 @@ def test_apply_data(): } @staticmethod - def test_get_capability(): + def test_get_capability() -> None: """Test the capability retrieval method.""" # Arrange data = get_json("device.json") @@ -81,7 +81,7 @@ class TestDeviceEntity: @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -92,7 +92,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests the save method.""" # Arrange device = DeviceEntity(api) @@ -102,7 +102,7 @@ async def test_save(api): @staticmethod @pytest.mark.asyncio - async def test_switch_on(api): + async def test_switch_on(api) -> None: """Tests the switch_on method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -114,7 +114,7 @@ async def test_switch_on(api): @staticmethod @pytest.mark.asyncio - async def test_switch_on_update(api): + async def test_switch_on_update(api) -> None: """Tests the switch_on method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -126,7 +126,7 @@ async def test_switch_on_update(api): @staticmethod @pytest.mark.asyncio - async def test_switch_off(api): + async def test_switch_off(api) -> None: """Tests the switch_on method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -139,7 +139,7 @@ async def test_switch_off(api): @staticmethod @pytest.mark.asyncio - async def test_switch_off_update(api): + async def test_switch_off_update(api) -> None: """Tests the switch_on method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -152,7 +152,7 @@ async def test_switch_off_update(api): @staticmethod @pytest.mark.asyncio - async def test_lock(api): + async def test_lock(api) -> None: """Tests the lock method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -164,7 +164,7 @@ async def test_lock(api): @staticmethod @pytest.mark.asyncio - async def test_lock_update(api): + async def test_lock_update(api) -> None: """Tests the lock method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -176,7 +176,7 @@ async def test_lock_update(api): @staticmethod @pytest.mark.asyncio - async def test_unlock(api): + async def test_unlock(api) -> None: """Tests the unlock method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -188,7 +188,7 @@ async def test_unlock(api): @staticmethod @pytest.mark.asyncio - async def test_unlock_update(api): + async def test_unlock_update(api) -> None: """Tests the unlock method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -200,7 +200,7 @@ async def test_unlock_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_level(api): + async def test_set_level(api) -> None: """Tests the set_level method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -213,7 +213,7 @@ async def test_set_level(api): @staticmethod @pytest.mark.asyncio - async def test_set_level_invalid(api): + async def test_set_level_invalid(api) -> None: """Tests the set_level method invalid values.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -228,7 +228,7 @@ async def test_set_level_invalid(api): @staticmethod @pytest.mark.asyncio - async def test_set_level_update(api): + async def test_set_level_update(api) -> None: """Tests the set_level method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -241,7 +241,7 @@ async def test_set_level_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_fan_speed(api): + async def test_set_fan_speed(api) -> None: """Tests the set_fan_speed method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -254,7 +254,7 @@ async def test_set_fan_speed(api): @staticmethod @pytest.mark.asyncio - async def test_set_fan_speed_invalid(api): + async def test_set_fan_speed_invalid(api) -> None: """Tests the set_fan_speed method invalid values.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -264,7 +264,7 @@ async def test_set_fan_speed_invalid(api): @staticmethod @pytest.mark.asyncio - async def test_set_fan_speed_update(api): + async def test_set_fan_speed_update(api) -> None: """Tests the set_fan_speed method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -276,7 +276,7 @@ async def test_set_fan_speed_update(api): assert device.status.switch @staticmethod - def test_status(): + def test_status() -> None: """Tests the set_level method.""" # Arrange device = DeviceEntity(None, device_id=DEVICE_ID) @@ -287,7 +287,7 @@ def test_status(): @staticmethod @pytest.mark.asyncio - async def test_set_color_temperature(api): + async def test_set_color_temperature(api) -> None: """Tests the set_color_temperature method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -299,7 +299,7 @@ async def test_set_color_temperature(api): @staticmethod @pytest.mark.asyncio - async def test_set_color_temperature_invalid(api): + async def test_set_color_temperature_invalid(api) -> None: """Tests the set_color_temperature method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -311,7 +311,7 @@ async def test_set_color_temperature_invalid(api): @staticmethod @pytest.mark.asyncio - async def test_set_color_temperature_update(api): + async def test_set_color_temperature_update(api) -> None: """Tests the set_color_temperature method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -323,7 +323,7 @@ async def test_set_color_temperature_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_hue(api): + async def test_set_hue(api) -> None: """Tests the set_hue method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -335,7 +335,7 @@ async def test_set_hue(api): @staticmethod @pytest.mark.asyncio - async def test_set_hue_invalid(api): + async def test_set_hue_invalid(api) -> None: """Tests the set_hue method invalid values.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -347,7 +347,7 @@ async def test_set_hue_invalid(api): @staticmethod @pytest.mark.asyncio - async def test_set_hue_update(api): + async def test_set_hue_update(api) -> None: """Tests the set_hue method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -359,7 +359,7 @@ async def test_set_hue_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_saturation(api): + async def test_set_saturation(api) -> None: """Tests the set_saturation method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -371,7 +371,7 @@ async def test_set_saturation(api): @staticmethod @pytest.mark.asyncio - async def test_set_saturation_invalid(api): + async def test_set_saturation_invalid(api) -> None: """Tests the set_saturation method invalid values.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -383,7 +383,7 @@ async def test_set_saturation_invalid(api): @staticmethod @pytest.mark.asyncio - async def test_set_saturation_update(api): + async def test_set_saturation_update(api) -> None: """Tests the set_saturation method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -395,7 +395,7 @@ async def test_set_saturation_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_color(api): + async def test_set_color(api) -> None: """Tests the set_color method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -409,7 +409,7 @@ async def test_set_color(api): @staticmethod @pytest.mark.asyncio - async def test_set_color_invalid(api): + async def test_set_color_invalid(api) -> None: """Tests the set_saturation method invalid values.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -423,7 +423,7 @@ async def test_set_color_invalid(api): @staticmethod @pytest.mark.asyncio - async def test_set_color_update(api): + async def test_set_color_update(api) -> None: """Tests the set_saturation method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -437,7 +437,7 @@ async def test_set_color_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_color_hex(api): + async def test_set_color_hex(api) -> None: """Tests the set_color method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -451,7 +451,7 @@ async def test_set_color_hex(api): @staticmethod @pytest.mark.asyncio - async def test_set_color_hex_invalid(api): + async def test_set_color_hex_invalid(api) -> None: """Tests the set_color method invalid values.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -463,7 +463,7 @@ async def test_set_color_hex_invalid(api): @staticmethod @pytest.mark.asyncio - async def test_set_color_update_hex(api): + async def test_set_color_update_hex(api) -> None: """Tests the set_saturation method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -477,7 +477,7 @@ async def test_set_color_update_hex(api): @staticmethod @pytest.mark.asyncio - async def test_set_thermostat_fan_mode_legacy(api): + async def test_set_thermostat_fan_mode_legacy(api) -> None: """Tests the set_saturation method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -491,7 +491,7 @@ async def test_set_thermostat_fan_mode_legacy(api): @staticmethod @pytest.mark.asyncio - async def test_set_thermostat_fan_mode(api): + async def test_set_thermostat_fan_mode(api) -> None: """Tests the set_saturation method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -505,7 +505,7 @@ async def test_set_thermostat_fan_mode(api): @staticmethod @pytest.mark.asyncio - async def test_set_thermostat_fan_mode_update(api): + async def test_set_thermostat_fan_mode_update(api) -> None: """Tests the set_saturation method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -519,7 +519,7 @@ async def test_set_thermostat_fan_mode_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_thermostat_mode_legacy(api): + async def test_set_thermostat_mode_legacy(api) -> None: """Tests the set_thermostat_mode method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -533,7 +533,7 @@ async def test_set_thermostat_mode_legacy(api): @staticmethod @pytest.mark.asyncio - async def test_set_thermostat_mode(api): + async def test_set_thermostat_mode(api) -> None: """Tests the set_thermostat_mode method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -547,7 +547,7 @@ async def test_set_thermostat_mode(api): @staticmethod @pytest.mark.asyncio - async def test_set_thermostat_mode_update(api): + async def test_set_thermostat_mode_update(api) -> None: """Tests the set_thermostat_mode method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -561,7 +561,7 @@ async def test_set_thermostat_mode_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_cooling_setpoint_legacy(api): + async def test_set_cooling_setpoint_legacy(api) -> None: """Tests the set_cooling_setpoint method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -575,7 +575,7 @@ async def test_set_cooling_setpoint_legacy(api): @staticmethod @pytest.mark.asyncio - async def test_set_cooling_setpoint_mode(api): + async def test_set_cooling_setpoint_mode(api) -> None: """Tests the set_cooling_setpoint method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -589,7 +589,7 @@ async def test_set_cooling_setpoint_mode(api): @staticmethod @pytest.mark.asyncio - async def test_set_cooling_setpoint_update(api): + async def test_set_cooling_setpoint_update(api) -> None: """Tests the set_cooling_setpoint method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -603,7 +603,7 @@ async def test_set_cooling_setpoint_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_heating_setpoint_legacy(api): + async def test_set_heating_setpoint_legacy(api) -> None: """Tests the set_heating_setpoint method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -617,7 +617,7 @@ async def test_set_heating_setpoint_legacy(api): @staticmethod @pytest.mark.asyncio - async def test_set_heating_setpoint_mode(api): + async def test_set_heating_setpoint_mode(api) -> None: """Tests the set_heating_setpoint method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -631,7 +631,7 @@ async def test_set_heating_setpoint_mode(api): @staticmethod @pytest.mark.asyncio - async def test_set_heating_setpoint_update(api): + async def test_set_heating_setpoint_update(api) -> None: """Tests the set_heating_setpoint method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -645,7 +645,7 @@ async def test_set_heating_setpoint_update(api): @staticmethod @pytest.mark.asyncio - async def test_open(api): + async def test_open(api) -> None: """Tests the open method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -658,7 +658,7 @@ async def test_open(api): @staticmethod @pytest.mark.asyncio - async def test_open_legacy(api): + async def test_open_legacy(api) -> None: """Tests the open method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -671,7 +671,7 @@ async def test_open_legacy(api): @staticmethod @pytest.mark.asyncio - async def test_close(api): + async def test_close(api) -> None: """Tests the close method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -684,7 +684,7 @@ async def test_close(api): @staticmethod @pytest.mark.asyncio - async def test_close_legacy(api): + async def test_close_legacy(api) -> None: """Tests the close method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -697,7 +697,7 @@ async def test_close_legacy(api): @staticmethod @pytest.mark.asyncio - async def test_open_window_shade(api): + async def test_open_window_shade(api) -> None: """Tests the open method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -710,7 +710,7 @@ async def test_open_window_shade(api): @staticmethod @pytest.mark.asyncio - async def test_close_window_shade(api): + async def test_close_window_shade(api) -> None: """Tests the close method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -723,7 +723,7 @@ async def test_close_window_shade(api): @staticmethod @pytest.mark.asyncio - async def test_request_drlc_action(api): + async def test_request_drlc_action(api) -> None: """Tests the request_drlc_action method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -742,7 +742,7 @@ async def test_request_drlc_action(api): @staticmethod @pytest.mark.asyncio - async def test_override_drlc_action(api): + async def test_override_drlc_action(api) -> None: """Tests the override_drlc_action method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -754,7 +754,7 @@ async def test_override_drlc_action(api): @staticmethod @pytest.mark.asyncio - async def test_execute(api): + async def test_execute(api) -> None: """Tests the execute method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -763,7 +763,7 @@ async def test_execute(api): @staticmethod @pytest.mark.asyncio - async def test_preset_position(api): + async def test_preset_position(api) -> None: """Tests the preset_position method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -772,7 +772,7 @@ async def test_preset_position(api): @staticmethod @pytest.mark.asyncio - async def test_set_air_conditioner_mode(api): + async def test_set_air_conditioner_mode(api) -> None: """Tests the set_air_conditioner_mode method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -784,7 +784,7 @@ async def test_set_air_conditioner_mode(api): @staticmethod @pytest.mark.asyncio - async def test_set_fan_mode(api): + async def test_set_fan_mode(api) -> None: """Tests the set_fan_mode method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -796,7 +796,7 @@ async def test_set_fan_mode(api): @staticmethod @pytest.mark.asyncio - async def test_set_fan_oscillation_mode(api): + async def test_set_fan_oscillation_mode(api) -> None: """Tests the set_fan_oscillation_mode method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -808,7 +808,7 @@ async def test_set_fan_oscillation_mode(api): @staticmethod @pytest.mark.asyncio - async def test_set_air_flow_direction(api): + async def test_set_air_flow_direction(api) -> None: """Tests the set_air_flow_direction method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -820,7 +820,7 @@ async def test_set_air_flow_direction(api): @staticmethod @pytest.mark.asyncio - async def test_mute(api): + async def test_mute(api) -> None: """Test the mute method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -833,7 +833,7 @@ async def test_mute(api): @staticmethod @pytest.mark.asyncio - async def test_mute_update(api): + async def test_mute_update(api) -> None: """Test the mute method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -846,7 +846,7 @@ async def test_mute_update(api): @staticmethod @pytest.mark.asyncio - async def test_unmute(api): + async def test_unmute(api) -> None: """Test the unmute method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -859,7 +859,7 @@ async def test_unmute(api): @staticmethod @pytest.mark.asyncio - async def test_unmute_update(api): + async def test_unmute_update(api) -> None: """Test the unmute method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -872,7 +872,7 @@ async def test_unmute_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_volume(api): + async def test_set_volume(api) -> None: """Test the set_volume method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -885,7 +885,7 @@ async def test_set_volume(api): @staticmethod @pytest.mark.asyncio - async def test_set_volume_update(api): + async def test_set_volume_update(api) -> None: """Test the set_volume method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -898,7 +898,7 @@ async def test_set_volume_update(api): @staticmethod @pytest.mark.asyncio - async def test_volume_up(api): + async def test_volume_up(api) -> None: """Test the volume_up method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -911,7 +911,7 @@ async def test_volume_up(api): @staticmethod @pytest.mark.asyncio - async def test_volume_up_update(api): + async def test_volume_up_update(api) -> None: """Test the volume_up method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -924,7 +924,7 @@ async def test_volume_up_update(api): @staticmethod @pytest.mark.asyncio - async def test_volume_down(api): + async def test_volume_down(api) -> None: """Test the volume_down method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -937,7 +937,7 @@ async def test_volume_down(api): @staticmethod @pytest.mark.asyncio - async def test_volume_down_update(api): + async def test_volume_down_update(api) -> None: """Test the volume_down method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -950,7 +950,7 @@ async def test_volume_down_update(api): @staticmethod @pytest.mark.asyncio - async def test_play(api): + async def test_play(api) -> None: """Test the play method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -963,7 +963,7 @@ async def test_play(api): @staticmethod @pytest.mark.asyncio - async def test_play_update(api): + async def test_play_update(api) -> None: """Test the play method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -976,7 +976,7 @@ async def test_play_update(api): @staticmethod @pytest.mark.asyncio - async def test_pause(api): + async def test_pause(api) -> None: """Test the pause method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -989,7 +989,7 @@ async def test_pause(api): @staticmethod @pytest.mark.asyncio - async def test_pause_update(api): + async def test_pause_update(api) -> None: """Test the pause method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1002,7 +1002,7 @@ async def test_pause_update(api): @staticmethod @pytest.mark.asyncio - async def test_stop(api): + async def test_stop(api) -> None: """Test the stop method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1015,7 +1015,7 @@ async def test_stop(api): @staticmethod @pytest.mark.asyncio - async def test_stop_update(api): + async def test_stop_update(api) -> None: """Test the stop method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1028,7 +1028,7 @@ async def test_stop_update(api): @staticmethod @pytest.mark.asyncio - async def test_fast_forward(api): + async def test_fast_forward(api) -> None: """Test the fast_forward method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1041,7 +1041,7 @@ async def test_fast_forward(api): @staticmethod @pytest.mark.asyncio - async def test_fast_forward_update(api): + async def test_fast_forward_update(api) -> None: """Test the fast_forward method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1054,7 +1054,7 @@ async def test_fast_forward_update(api): @staticmethod @pytest.mark.asyncio - async def test_rewind(api): + async def test_rewind(api) -> None: """Test the rewind method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1067,7 +1067,7 @@ async def test_rewind(api): @staticmethod @pytest.mark.asyncio - async def test_rewind_update(api): + async def test_rewind_update(api) -> None: """Test the rewind method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1080,7 +1080,7 @@ async def test_rewind_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_input_source(api): + async def test_set_input_source(api) -> None: """Test the set_input_source method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1096,7 +1096,7 @@ async def test_set_input_source(api): @staticmethod @pytest.mark.asyncio - async def test_set_input_source_update(api): + async def test_set_input_source_update(api) -> None: """Test the set_input_source method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1112,7 +1112,7 @@ async def test_set_input_source_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_playback_shuffle(api): + async def test_set_playback_shuffle(api) -> None: """Test the set_playback_shuffle method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1125,7 +1125,7 @@ async def test_set_playback_shuffle(api): @staticmethod @pytest.mark.asyncio - async def test_set_playback_shuffle_update(api): + async def test_set_playback_shuffle_update(api) -> None: """Test the set_playback_shuffle method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1138,7 +1138,7 @@ async def test_set_playback_shuffle_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_repeat(api): + async def test_set_repeat(api) -> None: """Test the set_repeat method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1151,7 +1151,7 @@ async def test_set_repeat(api): @staticmethod @pytest.mark.asyncio - async def test_set_repeat_update(api): + async def test_set_repeat_update(api) -> None: """Test the set_repeat method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1164,7 +1164,7 @@ async def test_set_repeat_update(api): @staticmethod @pytest.mark.asyncio - async def test_set_tv_channel(api): + async def test_set_tv_channel(api) -> None: """Test the tv_channel method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1177,7 +1177,7 @@ async def test_set_tv_channel(api): @staticmethod @pytest.mark.asyncio - async def test_set_tv_channel_update(api): + async def test_set_tv_channel_update(api) -> None: """Test the tv_channel method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1190,7 +1190,7 @@ async def test_set_tv_channel_update(api): @staticmethod @pytest.mark.asyncio - async def test_channel_up(api): + async def test_channel_up(api) -> None: """Test the channel_up method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1201,7 +1201,7 @@ async def test_channel_up(api): @staticmethod @pytest.mark.asyncio - async def test_channel_down(api): + async def test_channel_down(api) -> None: """Test the channel_down method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1212,7 +1212,7 @@ async def test_channel_down(api): @staticmethod @pytest.mark.asyncio - async def test_set_window_shade_level(api): + async def test_set_window_shade_level(api) -> None: """Tests the set_window_shade_level method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1225,7 +1225,7 @@ async def test_set_window_shade_level(api): @staticmethod @pytest.mark.asyncio - async def test_set_window_shade_level_invalid(api): + async def test_set_window_shade_level_invalid(api) -> None: """Tests the set_window_shade_level method invalid values.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1237,7 +1237,7 @@ async def test_set_window_shade_level_invalid(api): @staticmethod @pytest.mark.asyncio - async def test_set_window_shade_level_update(api): + async def test_set_window_shade_level_update(api) -> None: """Tests the set_window_shade_level method.""" # Arrange device = DeviceEntity(api, device_id=DEVICE_ID) @@ -1253,7 +1253,7 @@ class TestDeviceStatus: """Tests for the DeviceStatus class.""" @staticmethod - def test_init(): + def test_init() -> None: """Tests the init method.""" # Arrange/Act status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1266,7 +1266,7 @@ def test_init(): assert status.component_id == "main" @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Tests the apply_data method.""" # Arrange data = get_json("device_status.json") @@ -1281,7 +1281,7 @@ def test_apply_data(): assert len(status.components["bottomButton"].attributes) == 3 @staticmethod - def test_apply_attribute_update(): + def test_apply_attribute_update() -> None: """Tests the apply_attribute_update method.""" # Arrange data = get_json("device_status.json") @@ -1297,7 +1297,7 @@ def test_apply_attribute_update(): assert status.data == {"test": "test"} @staticmethod - def test_apply_attribute_update_preserve_unit(): + def test_apply_attribute_update_preserve_unit() -> None: """Tests the apply_attribute_update preserves the old unit.""" # Arrange data = get_json("device_status.json") @@ -1312,7 +1312,7 @@ def test_apply_attribute_update_preserve_unit(): assert status.unit == "%" @staticmethod - def test_apply_attribute_update_child_status(): + def test_apply_attribute_update_child_status() -> None: """Tests the apply_attribute_update method to a child status.""" # Arrange data = get_json("device_status.json") @@ -1323,7 +1323,7 @@ def test_apply_attribute_update_child_status(): assert status.components["bottomButton"].level == 50 @staticmethod - def test_values(): + def test_values() -> None: """Test the values property.""" # Arrange data = get_json("device_status.json") @@ -1342,7 +1342,7 @@ def test_values(): } @staticmethod - def test_attributes(): + def test_attributes() -> None: """Test the attributes property.""" # Arrange data = get_json("device_status.json") @@ -1365,7 +1365,7 @@ def test_attributes(): } @staticmethod - def test_attributes_default(): + def test_attributes_default() -> None: """Test the attributes property.""" # Arrange data = get_json("device_status.json") @@ -1375,7 +1375,7 @@ def test_attributes_default(): @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" # Arrange status = DeviceStatus(api, device_id=DEVICE_ID) @@ -1385,7 +1385,7 @@ async def test_refresh(api): assert len(status.attributes) == 9 @staticmethod - def test_switch(): + def test_switch() -> None: """Tests the switch property.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1395,7 +1395,7 @@ def test_switch(): assert status.switch @staticmethod - def test_level(): + def test_level() -> None: """Tests the level property.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1405,7 +1405,7 @@ def test_level(): assert status.level == 50 @staticmethod - def test_level_range(): + def test_level_range() -> None: """Tests the level property's range.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1416,7 +1416,7 @@ def test_level_range(): status.level = value @staticmethod - def test_fan_speed(): + def test_fan_speed() -> None: """Tests the fan_speed property.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1426,7 +1426,7 @@ def test_fan_speed(): assert status.fan_speed == 50 @staticmethod - def test_fan_speed_range(): + def test_fan_speed_range() -> None: """Tests the fan_speed property's range.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1435,7 +1435,7 @@ def test_fan_speed_range(): status.fan_speed = -1 @staticmethod - def test_hue_range(): + def test_hue_range() -> None: """Tests the hue property's range.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1446,7 +1446,7 @@ def test_hue_range(): status.hue = value @staticmethod - def test_saturation_range(): + def test_saturation_range() -> None: """Tests the hue property's range.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1457,7 +1457,7 @@ def test_saturation_range(): status.saturation = value @staticmethod - def test_color_temperature_range(): + def test_color_temperature_range() -> None: """Tests the hue property's range.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1468,7 +1468,7 @@ def test_color_temperature_range(): status.color_temperature = value @staticmethod - def test_color_format(): + def test_color_format() -> None: """Tests the color property's validation.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1479,7 +1479,7 @@ def test_color_format(): status.color = value @staticmethod - def test_volume_range(api): + def test_volume_range(api) -> None: """Test the volume property's range.""" # Arrange status = DeviceStatus(api, device_id=DEVICE_ID) @@ -1490,7 +1490,7 @@ def test_volume_range(api): status.volume = value @staticmethod - def test_input_source(api): + def test_input_source(api) -> None: """Test the volume property's range.""" # Arrange status = DeviceStatus(api, device_id=DEVICE_ID) @@ -1500,7 +1500,7 @@ def test_input_source(api): status.input_source = "INVALID" @staticmethod - def test_playback_repeat_mode(api): + def test_playback_repeat_mode(api) -> None: """Test the volume property's range.""" # Arrange status = DeviceStatus(api, device_id=DEVICE_ID) @@ -1509,7 +1509,7 @@ def test_playback_repeat_mode(api): status.playback_repeat_mode = "INVALID" @staticmethod - def test_is_on(): + def test_is_on() -> None: """Tests the is_on method.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1521,7 +1521,7 @@ def test_is_on(): assert not status.is_on(Attribute.switch) @staticmethod - def test_well_known_attributes(): + def test_well_known_attributes() -> None: """Tests the humidity property.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1562,7 +1562,7 @@ def test_well_known_attributes(): assert status.supported_ac_fan_modes == ["auto", "low"] @staticmethod - def test_well_known_ocf_attributes(): + def test_well_known_ocf_attributes() -> None: """Tests the OCF related attributes.""" # Arrange data = get_json("device_samsungac_status.json") @@ -1589,7 +1589,7 @@ def test_well_known_ocf_attributes(): assert status.ocf_vendor_id == "DA-AC-RAC-000001" @staticmethod - def test_well_known_drlc_attributes(): + def test_well_known_drlc_attributes() -> None: """Tests the drlc related attributes.""" status = DeviceStatus(None, device_id=DEVICE_ID) # No attribute @@ -1626,7 +1626,7 @@ def test_well_known_drlc_attributes(): assert status.drlc_status_level is None @staticmethod - def test_well_known_power_consumption_attributes(): + def test_well_known_power_consumption_attributes() -> None: """Tests the power consumption related attributes.""" status = DeviceStatus(None, device_id=DEVICE_ID) # No attribute @@ -1695,7 +1695,7 @@ def test_well_known_power_consumption_attributes(): assert status.power_consumption_power_energy is None @staticmethod - def test_shade_level(): + def test_shade_level() -> None: """Tests the shade_level property.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) @@ -1705,7 +1705,7 @@ def test_shade_level(): assert status.shade_level == 50 @staticmethod - def test_shade_level_range(): + def test_shade_level_range() -> None: """Tests the shade_level property's range.""" # Arrange status = DeviceStatus(None, device_id=DEVICE_ID) diff --git a/tests/test_errors.py b/tests/test_errors.py index 7eaeff9..1fceb8f 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -7,7 +7,7 @@ class TestAPIResponseError: """Tests for the APIResponseError class.""" @staticmethod - def test_is_target_error(): + def test_is_target_error() -> None: """Tests the initialization.""" # Arrange/Act data = { @@ -40,7 +40,7 @@ def test_is_target_error(): assert not detail.details @staticmethod - def test_str(): + def test_str() -> None: """Tests the initialization.""" # Arrange/Act data = {"requestId": "8B66A345-03B0-477F-A8A6-1A1CF0277040"} diff --git a/tests/test_installedapp.py b/tests/test_installedapp.py index 890109a..d0248de 100644 --- a/tests/test_installedapp.py +++ b/tests/test_installedapp.py @@ -17,7 +17,7 @@ class TestInstalledApp: """Tests for the InstalledApp class.""" @staticmethod - def test_init(): + def test_init() -> None: """Tests the initialization.""" # Arrange/Act app = InstalledApp() @@ -27,7 +27,7 @@ def test_init(): assert app.classifications == [] @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Tests the apply_data function.""" # Arrange app = InstalledApp() @@ -52,7 +52,7 @@ class TestInstalledAppEntity: @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" # Arrange app = InstalledAppEntity(api, installed_app_id=INSTALLED_APP_ID) @@ -63,7 +63,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests the refresh method.""" # Arrange app = InstalledAppEntity(api) @@ -73,7 +73,7 @@ async def test_save(api): @staticmethod @pytest.mark.asyncio - async def test_subscriptions(api): + async def test_subscriptions(api) -> None: """Tests the subscriptions method.""" # Arrange app = InstalledAppEntity(api, installed_app_id=INSTALLED_APP_ID) diff --git a/tests/test_location.py b/tests/test_location.py index 4019f82..1677cfb 100644 --- a/tests/test_location.py +++ b/tests/test_location.py @@ -12,7 +12,7 @@ class TestLocation: """Tests for the Location class.""" @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Tests the apply_data function.""" # Arrange data = get_json("location.json") @@ -36,7 +36,7 @@ class TestLocationEntity: @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" # Arrange entity = LocationEntity(api, location_id=LOCATION_ID) @@ -47,7 +47,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests the save method.""" # Arrange entity = LocationEntity(api) @@ -57,7 +57,7 @@ async def test_save(api): @staticmethod @pytest.mark.asyncio - async def test_rooms(api): + async def test_rooms(api) -> None: """Tests the refresh method.""" # Arrange entity = LocationEntity(api, location_id=LOCATION_ID) diff --git a/tests/test_oauthtoken.py b/tests/test_oauthtoken.py index cd23512..c34983b 100644 --- a/tests/test_oauthtoken.py +++ b/tests/test_oauthtoken.py @@ -12,7 +12,7 @@ class TestOAuthToken: """Tests for the OAuthToken class.""" @staticmethod - def test_init(): + def test_init() -> None: """Tests the init method.""" # Arrange/Act token = OAuthToken(None, None) @@ -21,7 +21,7 @@ def test_init(): assert token.scope == [] @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Tests the apply data method.""" # Arrange data = get_json("token_response.json") @@ -36,7 +36,7 @@ def test_apply_data(): @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" # Arrange token = OAuthToken(api, refresh_token=REFRESH_TOKEN) diff --git a/tests/test_room.py b/tests/test_room.py index a57c218..098ac36 100644 --- a/tests/test_room.py +++ b/tests/test_room.py @@ -11,7 +11,7 @@ class TestRoom: """Tests for the Room class.""" @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Test the init method.""" # Arrange data = get_json("room.json") @@ -29,7 +29,7 @@ class TestRoomEntity: @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" # Arrange entity = RoomEntity(api, location_id=LOCATION_ID, room_id=ROOM_ID) @@ -40,7 +40,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests the save method.""" # Arrange entity = RoomEntity(api, location_id=LOCATION_ID, room_id=ROOM_ID) diff --git a/tests/test_scenes.py b/tests/test_scenes.py index 0f79c4c..4526b44 100644 --- a/tests/test_scenes.py +++ b/tests/test_scenes.py @@ -10,7 +10,7 @@ class TestScene: """Tests for the scene class.""" @staticmethod - def test_apply_data(): + def test_apply_data() -> None: """Test the init method.""" # Arrange data = get_json("scenes.json") @@ -29,7 +29,7 @@ class TestSceneEntity: @staticmethod @pytest.mark.asyncio - async def test_execute(api): + async def test_execute(api) -> None: """Tests the execute method.""" # Arrange data = get_json("scenes.json") @@ -41,7 +41,7 @@ async def test_execute(api): @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" entity = SceneEntity(api) with pytest.raises(NotImplementedError): @@ -49,7 +49,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests the refresh method.""" entity = SceneEntity(api) with pytest.raises(NotImplementedError): diff --git a/tests/test_smartthings.py b/tests/test_smartthings.py index 56e380d..a5f8c2a 100644 --- a/tests/test_smartthings.py +++ b/tests/test_smartthings.py @@ -26,7 +26,7 @@ class TestSmartThings: @staticmethod @pytest.mark.asyncio - async def test_devices(smartthings): + async def test_devices(smartthings) -> None: """Tests devices are retrieved.""" # Act devices = await smartthings.devices() @@ -35,7 +35,7 @@ async def test_devices(smartthings): @staticmethod @pytest.mark.asyncio - async def test_devices_with_filter(smartthings): + async def test_devices_with_filter(smartthings) -> None: """Tests retrieving a filtered view of devices.""" # Act devices = await smartthings.devices( @@ -51,7 +51,7 @@ async def test_devices_with_filter(smartthings): @staticmethod @pytest.mark.asyncio - async def test_device(smartthings): + async def test_device(smartthings) -> None: """Tests the device(id) method.""" # Act device = await smartthings.device(DEVICE_ID) @@ -60,7 +60,7 @@ async def test_device(smartthings): @staticmethod @pytest.mark.asyncio - async def test_locations(smartthings): + async def test_locations(smartthings) -> None: """Tests locations are retrieved.""" # Act locations = await smartthings.locations() @@ -69,7 +69,7 @@ async def test_locations(smartthings): @staticmethod @pytest.mark.asyncio - async def test_location(smartthings): + async def test_location(smartthings) -> None: """Tests the location(id) method.""" # Act location = await smartthings.location(LOCATION_ID) @@ -78,7 +78,7 @@ async def test_location(smartthings): @staticmethod @pytest.mark.asyncio - async def test_rooms(smartthings): + async def test_rooms(smartthings) -> None: """Tests the rooms(id) method.""" # Act rooms = await smartthings.rooms(LOCATION_ID) @@ -87,7 +87,7 @@ async def test_rooms(smartthings): @staticmethod @pytest.mark.asyncio - async def test_create_room(smartthings): + async def test_create_room(smartthings) -> None: """Tests the create room method.""" # Arrange room = Room() @@ -101,7 +101,7 @@ async def test_create_room(smartthings): @staticmethod @pytest.mark.asyncio - async def test_update_room(smartthings): + async def test_update_room(smartthings) -> None: """Tests the create room method.""" # Arrange room = Room() @@ -116,7 +116,7 @@ async def test_update_room(smartthings): @staticmethod @pytest.mark.asyncio - async def test_room(smartthings): + async def test_room(smartthings) -> None: """Tests the room(id, id) method.""" # Act room = await smartthings.room(LOCATION_ID, ROOM_ID) @@ -125,7 +125,7 @@ async def test_room(smartthings): @staticmethod @pytest.mark.asyncio - async def test_delete_room(smartthings): + async def test_delete_room(smartthings) -> None: """Tests the delete room.""" # Act result = await smartthings.delete_room(LOCATION_ID, ROOM_ID) @@ -134,7 +134,7 @@ async def test_delete_room(smartthings): @staticmethod @pytest.mark.asyncio - async def test_apps(smartthings): + async def test_apps(smartthings) -> None: """Tests locations are retrieved.""" # Act apps = await smartthings.apps() @@ -143,7 +143,7 @@ async def test_apps(smartthings): @staticmethod @pytest.mark.asyncio - async def test_app(smartthings): + async def test_app(smartthings) -> None: """Tests the app(id) method.""" # Act app = await smartthings.app(APP_ID) @@ -152,7 +152,7 @@ async def test_app(smartthings): @staticmethod @pytest.mark.asyncio - async def test_create_app(smartthings): + async def test_create_app(smartthings) -> None: """Tests the create app method.""" # Arrange app = App() @@ -168,7 +168,7 @@ async def test_create_app(smartthings): @staticmethod @pytest.mark.asyncio - async def test_delete_app(smartthings): + async def test_delete_app(smartthings) -> None: """Tests the delete app method.""" # Act/Assert result = await smartthings.delete_app(APP_ID) @@ -177,7 +177,7 @@ async def test_delete_app(smartthings): @staticmethod @pytest.mark.asyncio - async def test_app_settings(smartthings): + async def test_app_settings(smartthings) -> None: """Tests retrieval of app settings.""" # Act settings = await smartthings.app_settings(APP_ID) @@ -187,7 +187,7 @@ async def test_app_settings(smartthings): @staticmethod @pytest.mark.asyncio - async def test_update_app_settings(smartthings): + async def test_update_app_settings(smartthings) -> None: """Tests updating app settings.""" # Arrange settings = AppSettings(APP_ID) @@ -200,7 +200,7 @@ async def test_update_app_settings(smartthings): @staticmethod @pytest.mark.asyncio - async def test_app_oauth(smartthings): + async def test_app_oauth(smartthings) -> None: """Tests retrieval of OAuth settings.""" # Act oauth = await smartthings.app_oauth(APP_ID) @@ -211,7 +211,7 @@ async def test_app_oauth(smartthings): @staticmethod @pytest.mark.asyncio - async def test_update_app_oauth(smartthings): + async def test_update_app_oauth(smartthings) -> None: """Tests updating OAuth settings.""" # Arrange oauth = AppOAuth(APP_ID) @@ -226,7 +226,7 @@ async def test_update_app_oauth(smartthings): @staticmethod @pytest.mark.asyncio - async def test_generate_app_oauth(smartthings): + async def test_generate_app_oauth(smartthings) -> None: """Tests generating new OAuth info.""" # Arrange oauth = AppOAuth(APP_ID) @@ -243,7 +243,7 @@ async def test_generate_app_oauth(smartthings): @staticmethod @pytest.mark.asyncio - async def test_installed_apps(smartthings): + async def test_installed_apps(smartthings) -> None: """Tests the installedapps method.""" # Act apps = await smartthings.installed_apps() @@ -252,7 +252,7 @@ async def test_installed_apps(smartthings): @staticmethod @pytest.mark.asyncio - async def test_installed_app(smartthings): + async def test_installed_app(smartthings) -> None: """Tests the installedapp(id) method.""" # Act app = await smartthings.installed_app(INSTALLED_APP_ID) @@ -261,7 +261,7 @@ async def test_installed_app(smartthings): @staticmethod @pytest.mark.asyncio - async def test_delete_installed_app(smartthings): + async def test_delete_installed_app(smartthings) -> None: """Tests the delete app method.""" # Act/Assert result = await smartthings.delete_installed_app(INSTALLED_APP_ID) @@ -270,7 +270,7 @@ async def test_delete_installed_app(smartthings): @staticmethod @pytest.mark.asyncio - async def test_subscriptions(smartthings): + async def test_subscriptions(smartthings) -> None: """Tests the get subscriptions method.""" # Act subscriptions = await smartthings.subscriptions(INSTALLED_APP_ID) @@ -279,7 +279,7 @@ async def test_subscriptions(smartthings): @staticmethod @pytest.mark.asyncio - async def test_delete_subscriptions(smartthings): + async def test_delete_subscriptions(smartthings) -> None: """Tests the delete subscriptions method.""" # Act count = await smartthings.delete_subscriptions(INSTALLED_APP_ID) @@ -288,7 +288,7 @@ async def test_delete_subscriptions(smartthings): @staticmethod @pytest.mark.asyncio - async def test_delete_subscription(smartthings): + async def test_delete_subscription(smartthings) -> None: """Tests the delete subscription method.""" # Act deleted = await smartthings.delete_subscription( @@ -299,7 +299,7 @@ async def test_delete_subscription(smartthings): @staticmethod @pytest.mark.asyncio - async def test_create_subscription(smartthings): + async def test_create_subscription(smartthings) -> None: """Tests the create subscription method.""" # Arrange sub = Subscription() @@ -314,7 +314,7 @@ async def test_create_subscription(smartthings): @staticmethod @pytest.mark.asyncio - async def test_scenes(smartthings): + async def test_scenes(smartthings) -> None: """Tests the scenes method.""" # Act scenes = await smartthings.scenes() @@ -323,7 +323,7 @@ async def test_scenes(smartthings): @staticmethod @pytest.mark.asyncio - async def test_scenes_with_location_filter(smartthings): + async def test_scenes_with_location_filter(smartthings) -> None: """Tests the scenes method.""" # Act scenes = await smartthings.scenes(location_id=LOCATION_ID) @@ -332,7 +332,7 @@ async def test_scenes_with_location_filter(smartthings): @staticmethod @pytest.mark.asyncio - async def test_execute_scene(smartthings): + async def test_execute_scene(smartthings) -> None: """Tests the execute scene method.""" # Act result = await smartthings.execute_scene(SCENE_ID) @@ -341,7 +341,7 @@ async def test_execute_scene(smartthings): @staticmethod @pytest.mark.asyncio - async def test_generate_tokens(smartthings): + async def test_generate_tokens(smartthings) -> None: """Tests the generate_tokens method.""" # Act token = await smartthings.generate_tokens( diff --git a/tests/test_subscription.py b/tests/test_subscription.py index 18be830..0e3473a 100644 --- a/tests/test_subscription.py +++ b/tests/test_subscription.py @@ -12,7 +12,7 @@ class TestSubscription: """Tests for the Subscription class.""" @staticmethod - def test_init(): + def test_init() -> None: """Test the initialization method.""" # Arrange/Act sub = Subscription() @@ -24,7 +24,7 @@ def test_init(): assert sub.state_change_only @staticmethod - def test_apply_data_capability(): + def test_apply_data_capability() -> None: """Test apply data.""" # Arrange data = get_json("subscription_capability_get_response.json") @@ -43,7 +43,7 @@ def test_apply_data_capability(): assert sub.subscription_name == "switchLevel_sub" @staticmethod - def test_apply_data_device(): + def test_apply_data_device() -> None: """Test apply data.""" # Arrange data = get_json("subscription_device_get_response.json") @@ -63,7 +63,7 @@ def test_apply_data_device(): assert not sub.subscription_name @staticmethod - def test_to_data_capability(): + def test_to_data_capability() -> None: """Test the to_data method for capabilities.""" # Arrange sub = Subscription() @@ -88,7 +88,7 @@ def test_to_data_capability(): assert not data["capability"]["stateChangeOnly"] @staticmethod - def test_to_data_device(): + def test_to_data_device() -> None: """Test the to_data method for devices.""" # Arrange sub = Subscription() @@ -118,7 +118,7 @@ class TestSubscriptionEntity: @staticmethod @pytest.mark.asyncio - async def test_refresh(api): + async def test_refresh(api) -> None: """Tests the refresh method.""" # Arrange app = SubscriptionEntity(api) @@ -136,7 +136,7 @@ async def test_refresh(api): @staticmethod @pytest.mark.asyncio - async def test_save(api): + async def test_save(api) -> None: """Tests the refresh method.""" # Arrange app = SubscriptionEntity(api) diff --git a/tests/utilities.py b/tests/utilities.py index 762b400..4cccbd9 100644 --- a/tests/utilities.py +++ b/tests/utilities.py @@ -35,7 +35,7 @@ def _get_json_fixture(body: BodyFixtureType) -> BodyType: class ClientMocker: """Mock Aiohttp client requests.""" - def __init__(self): + def __init__(self) -> None: """Initialize the request mocker.""" self._mocks = [] self.default_headers = None @@ -135,7 +135,7 @@ async def match_request( class MockResponse: """Mock Aiohttp client response.""" - def __init__(self, method, url, params, status, headers, request, response): + def __init__(self, method, url, params, status, headers, request, response) -> None: """Initialize a fake response.""" self.method = method url = URL(url)