diff --git a/tests/components/mystrom/__init__.py b/tests/components/mystrom/__init__.py index 21f6bd7a549..acd520cebaa 100644 --- a/tests/components/mystrom/__init__.py +++ b/tests/components/mystrom/__init__.py @@ -1,5 +1,5 @@ """Tests for the myStrom integration.""" -from typing import Any, Optional +from typing import Any def get_default_device_response(device_type: int | None) -> dict[str, Any]: @@ -79,49 +79,49 @@ class MyStromBulbMock(MyStromDeviceMock): self.mac = mac @property - def firmware(self) -> Optional[str]: + def firmware(self) -> str | None: """Return current firmware.""" if not self._requested_state: return None return self._state["fw_version"] @property - def consumption(self) -> Optional[float]: + def consumption(self) -> float | None: """Return current firmware.""" if not self._requested_state: return None return self._state["power"] @property - def color(self) -> Optional[str]: + def color(self) -> str | None: """Return current color settings.""" if not self._requested_state: return None return self._state["color"] @property - def mode(self) -> Optional[str]: + def mode(self) -> str | None: """Return current mode.""" if not self._requested_state: return None return self._state["mode"] @property - def transition_time(self) -> Optional[int]: + def transition_time(self) -> int | None: """Return current transition time (ramp).""" if not self._requested_state: return None return self._state["ramp"] @property - def bulb_type(self) -> Optional[str]: + def bulb_type(self) -> str | None: """Return the type of the bulb.""" if not self._requested_state: return None return self._state["type"] @property - def state(self) -> Optional[bool]: + def state(self) -> bool | None: """Return the current state of the bulb.""" if not self._requested_state: return None @@ -132,42 +132,42 @@ class MyStromSwitchMock(MyStromDeviceMock): """MyStrom Switch mock.""" @property - def relay(self) -> Optional[bool]: + def relay(self) -> bool | None: """Return the relay state.""" if not self._requested_state: return None return self._state["on"] @property - def consumption(self) -> Optional[float]: + def consumption(self) -> float | None: """Return the current power consumption in mWh.""" if not self._requested_state: return None return self._state["power"] @property - def consumedWs(self) -> Optional[float]: + def consumedWs(self) -> float | None: """The average of energy consumed per second since last report call.""" if not self._requested_state: return None return self._state["Ws"] @property - def firmware(self) -> Optional[str]: + def firmware(self) -> str | None: """Return the current firmware.""" if not self._requested_state: return None return self._state["version"] @property - def mac(self) -> Optional[str]: + def mac(self) -> str | None: """Return the MAC address.""" if not self._requested_state: return None return self._state["mac"] @property - def temperature(self) -> Optional[float]: + def temperature(self) -> float | None: """Return the current temperature in celsius.""" if not self._requested_state: return None diff --git a/tests/components/twitch/__init__.py b/tests/components/twitch/__init__.py index 5c371a0e2ee..bf35484f53e 100644 --- a/tests/components/twitch/__init__.py +++ b/tests/components/twitch/__init__.py @@ -2,7 +2,7 @@ import asyncio from collections.abc import AsyncGenerator from dataclasses import dataclass -from typing import Any, Optional +from typing import Any from twitchAPI.object import TwitchUser from twitchAPI.twitch import ( @@ -88,7 +88,7 @@ class TwitchMock: pass async def get_users( - self, user_ids: Optional[list[str]] = None, logins: Optional[list[str]] = None + self, user_ids: list[str] | None = None, logins: list[str] | None = None ) -> AsyncGenerator[TwitchUser, None]: """Get list of mock users.""" for user in [USER_OBJECT]: @@ -101,7 +101,7 @@ class TwitchMock: return True async def get_users_follows( - self, to_id: Optional[str] = None, from_id: Optional[str] = None + self, to_id: str | None = None, from_id: str | None = None ) -> TwitchUserFollowResultMock: """Return the followers of the user.""" if self._is_following: @@ -169,7 +169,7 @@ class TwitchInvalidUserMock(TwitchMock): """Twitch mock to test invalid user.""" async def get_users( - self, user_ids: Optional[list[str]] = None, logins: Optional[list[str]] = None + self, user_ids: list[str] | None = None, logins: list[str] | None = None ) -> AsyncGenerator[TwitchUser, None]: """Get list of mock users.""" if user_ids is not None or logins is not None: