mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Add missing return type to some test functions (#119665)
This commit is contained in:
parent
26e21bb356
commit
38a6e666a7
@ -79,7 +79,7 @@ async def test_login_flow_works(hass: HomeAssistant, manager) -> None:
|
||||
|
||||
async def test_create_repair_issue(
|
||||
hass: HomeAssistant, issue_registry: ir.IssueRegistry
|
||||
):
|
||||
) -> None:
|
||||
"""Test legacy api password auth provider creates a reapir issue."""
|
||||
hass.auth = await auth.auth_manager_from_config(hass, [CONFIG], [])
|
||||
ensure_auth_manager_loaded(hass.auth)
|
||||
|
@ -901,7 +901,7 @@ class MockEntityPlatform(entity_platform.EntityPlatform):
|
||||
platform=None,
|
||||
scan_interval=timedelta(seconds=15),
|
||||
entity_namespace=None,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize a mock entity platform."""
|
||||
if logger is None:
|
||||
logger = logging.getLogger("homeassistant.helpers.entity_platform")
|
||||
|
@ -72,7 +72,7 @@ class FakeScanner(BaseHaRemoteScanner):
|
||||
class BaseFakeBleakClient:
|
||||
"""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."""
|
||||
self._device_path = "/dev/test"
|
||||
self._device = address_or_ble_device
|
||||
|
@ -168,7 +168,7 @@ async def test_form_import_errors(
|
||||
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."""
|
||||
|
||||
with patch(
|
||||
|
@ -77,7 +77,7 @@ class HomeFactory:
|
||||
hass: HomeAssistant,
|
||||
mock_connection,
|
||||
hmip_config_entry: config_entries.ConfigEntry,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the Factory."""
|
||||
self.hass = hass
|
||||
self.mock_connection = mock_connection
|
||||
|
@ -44,7 +44,7 @@ class KNXTestKit:
|
||||
|
||||
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."""
|
||||
self.hass: HomeAssistant = hass
|
||||
self.mock_config_entry: MockConfigEntry = mock_config_entry
|
||||
|
@ -254,7 +254,7 @@ class MockLight(MockToggleEntity, LightEntity):
|
||||
state,
|
||||
unique_id=None,
|
||||
supported_color_modes: set[ColorMode] | None = None,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the mock light."""
|
||||
super().__init__(name, state, unique_id)
|
||||
if supported_color_modes is None:
|
||||
|
@ -27,7 +27,7 @@ class MockRow:
|
||||
event_type: str,
|
||||
data: dict[str, Any] | None = None,
|
||||
context: Context | None = None,
|
||||
):
|
||||
) -> None:
|
||||
"""Init the fake row."""
|
||||
self.event_type = event_type
|
||||
self.event_data = json.dumps(data, cls=JSONEncoder)
|
||||
|
@ -111,7 +111,7 @@ class MockPraw:
|
||||
username: str,
|
||||
password: str,
|
||||
user_agent: str,
|
||||
):
|
||||
) -> None:
|
||||
"""Add mock data for API return."""
|
||||
self._data = MOCK_RESULTS
|
||||
|
||||
@ -123,7 +123,7 @@ class MockPraw:
|
||||
class MockSubreddit:
|
||||
"""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."""
|
||||
self._subreddit = subreddit
|
||||
self._data = data
|
||||
|
@ -323,7 +323,7 @@ class MockMusicServiceItem:
|
||||
parent_id: str,
|
||||
item_class: str,
|
||||
album_art_uri: None | str = None,
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize the mock item."""
|
||||
self.title = title
|
||||
self.item_id = item_id
|
||||
|
@ -19,7 +19,7 @@ class MockYouTube:
|
||||
channel_fixture: str = "youtube/get_channel.json",
|
||||
playlist_items_fixture: str = "youtube/get_playlist_items.json",
|
||||
subscriptions_fixture: str = "youtube/get_subscriptions.json",
|
||||
):
|
||||
) -> None:
|
||||
"""Initialize mock service."""
|
||||
self._channel_fixture = channel_fixture
|
||||
self._playlist_items_fixture = playlist_items_fixture
|
||||
|
@ -1873,7 +1873,7 @@ async def test_change_entity_id(
|
||||
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."""
|
||||
|
||||
obj = entity.EntityDescription("blah", device_class="test")
|
||||
@ -1888,7 +1888,7 @@ def test_entity_description_as_dataclass(snapshot: SnapshotAssertion):
|
||||
assert repr(obj) == snapshot
|
||||
|
||||
|
||||
def test_extending_entity_description(snapshot: SnapshotAssertion):
|
||||
def test_extending_entity_description(snapshot: SnapshotAssertion) -> None:
|
||||
"""Test extending entity descriptions."""
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
|
@ -2067,7 +2067,7 @@ def test_states_function(hass: HomeAssistant) -> None:
|
||||
|
||||
async def test_state_translated(
|
||||
hass: HomeAssistant, entity_registry: er.EntityRegistry
|
||||
):
|
||||
) -> None:
|
||||
"""Test state_translated method."""
|
||||
assert await async_setup_component(
|
||||
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."""
|
||||
translation.async_setup(hass)
|
||||
|
||||
@ -577,7 +577,7 @@ async def test_setup(hass: HomeAssistant):
|
||||
mock.assert_not_called()
|
||||
|
||||
|
||||
async def test_translate_state(hass: HomeAssistant):
|
||||
async def test_translate_state(hass: HomeAssistant) -> None:
|
||||
"""Test the state translation helper."""
|
||||
result = translation.async_translate_state(
|
||||
hass, "unavailable", "binary_sensor", "platform", "translation_key", None
|
||||
|
@ -287,7 +287,9 @@ async def test_async_initialize_triggers(
|
||||
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."""
|
||||
update_1 = MagicMock()
|
||||
update_2 = MagicMock()
|
||||
|
Loading…
x
Reference in New Issue
Block a user