Add missing return type to some test functions (#119665)

This commit is contained in:
epenet 2024-06-14 08:26:45 +02:00 committed by GitHub
parent 26e21bb356
commit 38a6e666a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 20 additions and 18 deletions

View File

@ -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)

View File

@ -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")

View File

@ -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

View File

@ -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(

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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,

View File

@ -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

View File

@ -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()