Adjust type hints for unnecessary returns in tests (#121657)
This commit is contained in:
parent
d10aa6656b
commit
86f7718c1f
8 changed files with 17 additions and 10 deletions
|
@ -37,7 +37,7 @@ class AdbDeviceTcpAsyncFake:
|
|||
"""Try to connect to a device."""
|
||||
raise NotImplementedError
|
||||
|
||||
async def shell(self, cmd, *args, **kwargs):
|
||||
async def shell(self, cmd, *args, **kwargs) -> bytes | str | None:
|
||||
"""Send an ADB shell command."""
|
||||
return None
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class MockDevice:
|
|||
}
|
||||
}
|
||||
|
||||
def get_version(self):
|
||||
def get_version(self) -> str | None:
|
||||
"""Return the version."""
|
||||
return None
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import datetime
|
|||
from unittest.mock import patch
|
||||
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
from pyipma.observation import Observation
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
|
@ -43,7 +44,7 @@ TEST_CONFIG_HOURLY = {
|
|||
class MockBadLocation(MockLocation):
|
||||
"""Mock Location with unresponsive api."""
|
||||
|
||||
async def observation(self, api):
|
||||
async def observation(self, api) -> Observation | None:
|
||||
"""Mock Observation."""
|
||||
return None
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ def register_words_fixture():
|
|||
|
||||
|
||||
@pytest.fixture(name="config_addon")
|
||||
def config_addon_fixture():
|
||||
def config_addon_fixture() -> dict[str, Any] | None:
|
||||
"""Add extra configuration items."""
|
||||
return None
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.components.nest.const import API_URL, OAUTH2_TOKEN, SDM_SCOPE
|
|||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util import dt as dt_util
|
||||
|
||||
from .common import CLIENT_ID, CLIENT_SECRET, PROJECT_ID, PlatformSetup
|
||||
from .common import CLIENT_ID, CLIENT_SECRET, PROJECT_ID, FakeSubscriber, PlatformSetup
|
||||
from .conftest import FAKE_REFRESH_TOKEN, FAKE_TOKEN
|
||||
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
@ -27,7 +27,7 @@ FAKE_UPDATED_TOKEN = "fake-updated-token"
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def subscriber() -> None:
|
||||
def subscriber() -> FakeSubscriber | None:
|
||||
"""Disable default subscriber since tests use their own patch."""
|
||||
return None
|
||||
|
||||
|
|
|
@ -67,13 +67,15 @@ def warning_caplog(
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def subscriber_side_effect() -> None:
|
||||
def subscriber_side_effect() -> Any | None:
|
||||
"""Fixture to inject failures into FakeSubscriber start."""
|
||||
return None
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def failing_subscriber(subscriber_side_effect: Any) -> YieldFixture[FakeSubscriber]:
|
||||
def failing_subscriber(
|
||||
subscriber_side_effect: Any | None,
|
||||
) -> YieldFixture[FakeSubscriber]:
|
||||
"""Fixture overriding default subscriber behavior to allow failure injection."""
|
||||
subscriber = FakeSubscriber()
|
||||
with patch(
|
||||
|
|
|
@ -226,7 +226,11 @@ async def test_invalid_service(
|
|||
) -> None:
|
||||
"""Test service setup with an invalid service object or platform."""
|
||||
|
||||
def get_service(hass, config, discovery_info=None):
|
||||
def get_service(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> notify.BaseNotificationService | None:
|
||||
"""Return None for an invalid notify service."""
|
||||
return None
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ def mock_responses() -> list[AiohttpClientMockResponse]:
|
|||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def config_entry_data() -> None:
|
||||
async def config_entry_data() -> dict[str, Any] | None:
|
||||
"""Fixture to disable config entry setup for exercising config flow."""
|
||||
return None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue