Add missing return type to some test functions (#119665)
This commit is contained in:
parent
26e21bb356
commit
38a6e666a7
15 changed files with 20 additions and 18 deletions
|
@ -79,7 +79,7 @@ async def test_login_flow_works(hass: HomeAssistant, manager) -> None:
|
||||||
|
|
||||||
async def test_create_repair_issue(
|
async def test_create_repair_issue(
|
||||||
hass: HomeAssistant, issue_registry: ir.IssueRegistry
|
hass: HomeAssistant, issue_registry: ir.IssueRegistry
|
||||||
):
|
) -> None:
|
||||||
"""Test legacy api password auth provider creates a reapir issue."""
|
"""Test legacy api password auth provider creates a reapir issue."""
|
||||||
hass.auth = await auth.auth_manager_from_config(hass, [CONFIG], [])
|
hass.auth = await auth.auth_manager_from_config(hass, [CONFIG], [])
|
||||||
ensure_auth_manager_loaded(hass.auth)
|
ensure_auth_manager_loaded(hass.auth)
|
||||||
|
|
|
@ -901,7 +901,7 @@ class MockEntityPlatform(entity_platform.EntityPlatform):
|
||||||
platform=None,
|
platform=None,
|
||||||
scan_interval=timedelta(seconds=15),
|
scan_interval=timedelta(seconds=15),
|
||||||
entity_namespace=None,
|
entity_namespace=None,
|
||||||
):
|
) -> None:
|
||||||
"""Initialize a mock entity platform."""
|
"""Initialize a mock entity platform."""
|
||||||
if logger is None:
|
if logger is None:
|
||||||
logger = logging.getLogger("homeassistant.helpers.entity_platform")
|
logger = logging.getLogger("homeassistant.helpers.entity_platform")
|
||||||
|
|
|
@ -72,7 +72,7 @@ class FakeScanner(BaseHaRemoteScanner):
|
||||||
class BaseFakeBleakClient:
|
class BaseFakeBleakClient:
|
||||||
"""Base class for fake bleak clients."""
|
"""Base class for fake bleak clients."""
|
||||||
|
|
||||||
def __init__(self, address_or_ble_device: BLEDevice | str, **kwargs):
|
def __init__(self, address_or_ble_device: BLEDevice | str, **kwargs) -> None:
|
||||||
"""Initialize the fake bleak client."""
|
"""Initialize the fake bleak client."""
|
||||||
self._device_path = "/dev/test"
|
self._device_path = "/dev/test"
|
||||||
self._device = address_or_ble_device
|
self._device = address_or_ble_device
|
||||||
|
|
|
@ -168,7 +168,7 @@ async def test_form_import_errors(
|
||||||
assert result["reason"] == error_type
|
assert result["reason"] == error_type
|
||||||
|
|
||||||
|
|
||||||
async def test_options_flow(hass: HomeAssistant, user_flow: str):
|
async def test_options_flow(hass: HomeAssistant, user_flow: str) -> None:
|
||||||
"""Test the form options."""
|
"""Test the form options."""
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
|
|
|
@ -77,7 +77,7 @@ class HomeFactory:
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
mock_connection,
|
mock_connection,
|
||||||
hmip_config_entry: config_entries.ConfigEntry,
|
hmip_config_entry: config_entries.ConfigEntry,
|
||||||
):
|
) -> None:
|
||||||
"""Initialize the Factory."""
|
"""Initialize the Factory."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.mock_connection = mock_connection
|
self.mock_connection = mock_connection
|
||||||
|
|
|
@ -44,7 +44,7 @@ class KNXTestKit:
|
||||||
|
|
||||||
INDIVIDUAL_ADDRESS = "1.2.3"
|
INDIVIDUAL_ADDRESS = "1.2.3"
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, mock_config_entry: MockConfigEntry):
|
def __init__(self, hass: HomeAssistant, mock_config_entry: MockConfigEntry) -> None:
|
||||||
"""Init KNX test helper class."""
|
"""Init KNX test helper class."""
|
||||||
self.hass: HomeAssistant = hass
|
self.hass: HomeAssistant = hass
|
||||||
self.mock_config_entry: MockConfigEntry = mock_config_entry
|
self.mock_config_entry: MockConfigEntry = mock_config_entry
|
||||||
|
|
|
@ -254,7 +254,7 @@ class MockLight(MockToggleEntity, LightEntity):
|
||||||
state,
|
state,
|
||||||
unique_id=None,
|
unique_id=None,
|
||||||
supported_color_modes: set[ColorMode] | None = None,
|
supported_color_modes: set[ColorMode] | None = None,
|
||||||
):
|
) -> None:
|
||||||
"""Initialize the mock light."""
|
"""Initialize the mock light."""
|
||||||
super().__init__(name, state, unique_id)
|
super().__init__(name, state, unique_id)
|
||||||
if supported_color_modes is None:
|
if supported_color_modes is None:
|
||||||
|
|
|
@ -27,7 +27,7 @@ class MockRow:
|
||||||
event_type: str,
|
event_type: str,
|
||||||
data: dict[str, Any] | None = None,
|
data: dict[str, Any] | None = None,
|
||||||
context: Context | None = None,
|
context: Context | None = None,
|
||||||
):
|
) -> None:
|
||||||
"""Init the fake row."""
|
"""Init the fake row."""
|
||||||
self.event_type = event_type
|
self.event_type = event_type
|
||||||
self.event_data = json.dumps(data, cls=JSONEncoder)
|
self.event_data = json.dumps(data, cls=JSONEncoder)
|
||||||
|
|
|
@ -111,7 +111,7 @@ class MockPraw:
|
||||||
username: str,
|
username: str,
|
||||||
password: str,
|
password: str,
|
||||||
user_agent: str,
|
user_agent: str,
|
||||||
):
|
) -> None:
|
||||||
"""Add mock data for API return."""
|
"""Add mock data for API return."""
|
||||||
self._data = MOCK_RESULTS
|
self._data = MOCK_RESULTS
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class MockPraw:
|
||||||
class MockSubreddit:
|
class MockSubreddit:
|
||||||
"""Mock class for a subreddit instance."""
|
"""Mock class for a subreddit instance."""
|
||||||
|
|
||||||
def __init__(self, subreddit: str, data):
|
def __init__(self, subreddit: str, data) -> None:
|
||||||
"""Add mock data for API return."""
|
"""Add mock data for API return."""
|
||||||
self._subreddit = subreddit
|
self._subreddit = subreddit
|
||||||
self._data = data
|
self._data = data
|
||||||
|
|
|
@ -323,7 +323,7 @@ class MockMusicServiceItem:
|
||||||
parent_id: str,
|
parent_id: str,
|
||||||
item_class: str,
|
item_class: str,
|
||||||
album_art_uri: None | str = None,
|
album_art_uri: None | str = None,
|
||||||
):
|
) -> None:
|
||||||
"""Initialize the mock item."""
|
"""Initialize the mock item."""
|
||||||
self.title = title
|
self.title = title
|
||||||
self.item_id = item_id
|
self.item_id = item_id
|
||||||
|
|
|
@ -19,7 +19,7 @@ class MockYouTube:
|
||||||
channel_fixture: str = "youtube/get_channel.json",
|
channel_fixture: str = "youtube/get_channel.json",
|
||||||
playlist_items_fixture: str = "youtube/get_playlist_items.json",
|
playlist_items_fixture: str = "youtube/get_playlist_items.json",
|
||||||
subscriptions_fixture: str = "youtube/get_subscriptions.json",
|
subscriptions_fixture: str = "youtube/get_subscriptions.json",
|
||||||
):
|
) -> None:
|
||||||
"""Initialize mock service."""
|
"""Initialize mock service."""
|
||||||
self._channel_fixture = channel_fixture
|
self._channel_fixture = channel_fixture
|
||||||
self._playlist_items_fixture = playlist_items_fixture
|
self._playlist_items_fixture = playlist_items_fixture
|
||||||
|
|
|
@ -1873,7 +1873,7 @@ async def test_change_entity_id(
|
||||||
assert len(ent.remove_calls) == 2
|
assert len(ent.remove_calls) == 2
|
||||||
|
|
||||||
|
|
||||||
def test_entity_description_as_dataclass(snapshot: SnapshotAssertion):
|
def test_entity_description_as_dataclass(snapshot: SnapshotAssertion) -> None:
|
||||||
"""Test EntityDescription behaves like a dataclass."""
|
"""Test EntityDescription behaves like a dataclass."""
|
||||||
|
|
||||||
obj = entity.EntityDescription("blah", device_class="test")
|
obj = entity.EntityDescription("blah", device_class="test")
|
||||||
|
@ -1888,7 +1888,7 @@ def test_entity_description_as_dataclass(snapshot: SnapshotAssertion):
|
||||||
assert repr(obj) == snapshot
|
assert repr(obj) == snapshot
|
||||||
|
|
||||||
|
|
||||||
def test_extending_entity_description(snapshot: SnapshotAssertion):
|
def test_extending_entity_description(snapshot: SnapshotAssertion) -> None:
|
||||||
"""Test extending entity descriptions."""
|
"""Test extending entity descriptions."""
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True)
|
@dataclasses.dataclass(frozen=True)
|
||||||
|
|
|
@ -2067,7 +2067,7 @@ def test_states_function(hass: HomeAssistant) -> None:
|
||||||
|
|
||||||
async def test_state_translated(
|
async def test_state_translated(
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||||
):
|
) -> None:
|
||||||
"""Test state_translated method."""
|
"""Test state_translated method."""
|
||||||
assert await async_setup_component(
|
assert await async_setup_component(
|
||||||
hass,
|
hass,
|
||||||
|
|
|
@ -549,7 +549,7 @@ async def test_get_cached_translations(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async def test_setup(hass: HomeAssistant):
|
async def test_setup(hass: HomeAssistant) -> None:
|
||||||
"""Test the setup load listeners helper."""
|
"""Test the setup load listeners helper."""
|
||||||
translation.async_setup(hass)
|
translation.async_setup(hass)
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ async def test_setup(hass: HomeAssistant):
|
||||||
mock.assert_not_called()
|
mock.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
async def test_translate_state(hass: HomeAssistant):
|
async def test_translate_state(hass: HomeAssistant) -> None:
|
||||||
"""Test the state translation helper."""
|
"""Test the state translation helper."""
|
||||||
result = translation.async_translate_state(
|
result = translation.async_translate_state(
|
||||||
hass, "unavailable", "binary_sensor", "platform", "translation_key", None
|
hass, "unavailable", "binary_sensor", "platform", "translation_key", None
|
||||||
|
|
|
@ -287,7 +287,9 @@ async def test_async_initialize_triggers(
|
||||||
unsub()
|
unsub()
|
||||||
|
|
||||||
|
|
||||||
async def test_pluggable_action(hass: HomeAssistant, service_calls: list[ServiceCall]):
|
async def test_pluggable_action(
|
||||||
|
hass: HomeAssistant, service_calls: list[ServiceCall]
|
||||||
|
) -> None:
|
||||||
"""Test normal behavior of pluggable actions."""
|
"""Test normal behavior of pluggable actions."""
|
||||||
update_1 = MagicMock()
|
update_1 = MagicMock()
|
||||||
update_2 = MagicMock()
|
update_2 = MagicMock()
|
||||||
|
|
Loading…
Add table
Reference in a new issue