Update generator typing (#123052)

This commit is contained in:
Marc Mueller 2024-08-02 12:17:51 +02:00 committed by GitHub
parent adf8515698
commit b2d5f9c742
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 26 additions and 26 deletions

View File

@ -40,7 +40,7 @@ def sync_status() -> SyncStatus:
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
def mock_setup_entry() -> Generator[AsyncMock]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.bluesound.async_setup_entry", return_value=True

View File

@ -15,7 +15,7 @@ from tests.common import MockConfigEntry
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
def mock_setup_entry() -> Generator[AsyncMock]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.bryant_evolution.async_setup_entry", return_value=True
@ -31,7 +31,7 @@ for the Bryant Evolution integration.
@pytest.fixture(autouse=True)
def mock_evolution_client_factory() -> Generator[AsyncMock, None, None]:
def mock_evolution_client_factory() -> Generator[AsyncMock]:
"""Mock an Evolution client."""
with patch(
"evolutionhttp.BryantEvolutionLocalClient.get_client",

View File

@ -52,7 +52,7 @@ async def test_setup_integration_success(
async def test_set_temperature_mode_cool(
hass: HomeAssistant,
mock_evolution_entry: MockConfigEntry,
mock_evolution_client_factory: Generator[AsyncMock, None, None],
mock_evolution_client_factory: Generator[AsyncMock],
freezer: FrozenDateTimeFactory,
) -> None:
"""Test setting the temperature in cool mode."""
@ -83,7 +83,7 @@ async def test_set_temperature_mode_cool(
async def test_set_temperature_mode_heat(
hass: HomeAssistant,
mock_evolution_entry: MockConfigEntry,
mock_evolution_client_factory: Generator[AsyncMock, None, None],
mock_evolution_client_factory: Generator[AsyncMock],
freezer: FrozenDateTimeFactory,
) -> None:
"""Test setting the temperature in heat mode."""
@ -111,7 +111,7 @@ async def test_set_temperature_mode_heat(
async def test_set_temperature_mode_heat_cool(
hass: HomeAssistant,
mock_evolution_entry: MockConfigEntry,
mock_evolution_client_factory: Generator[AsyncMock, None, None],
mock_evolution_client_factory: Generator[AsyncMock],
freezer: FrozenDateTimeFactory,
) -> None:
"""Test setting the temperature in heat_cool mode."""
@ -147,7 +147,7 @@ async def test_set_temperature_mode_heat_cool(
async def test_set_fan_mode(
hass: HomeAssistant,
mock_evolution_entry: MockConfigEntry,
mock_evolution_client_factory: Generator[AsyncMock, None, None],
mock_evolution_client_factory: Generator[AsyncMock],
) -> None:
"""Test that setting fan mode works."""
mock_client = await mock_evolution_client_factory(1, 1, "/dev/unused")
@ -175,7 +175,7 @@ async def test_set_fan_mode(
async def test_set_hvac_mode(
hass: HomeAssistant,
mock_evolution_entry: MockConfigEntry,
mock_evolution_client_factory: Generator[AsyncMock, None, None],
mock_evolution_client_factory: Generator[AsyncMock],
hvac_mode,
evolution_mode,
) -> None:
@ -203,7 +203,7 @@ async def test_set_hvac_mode(
async def test_read_hvac_action_heat_cool(
hass: HomeAssistant,
mock_evolution_entry: MockConfigEntry,
mock_evolution_client_factory: Generator[AsyncMock, None, None],
mock_evolution_client_factory: Generator[AsyncMock],
freezer: FrozenDateTimeFactory,
curr_temp: int,
expected_action: HVACAction,
@ -236,7 +236,7 @@ async def test_read_hvac_action_heat_cool(
async def test_read_hvac_action(
hass: HomeAssistant,
mock_evolution_entry: MockConfigEntry,
mock_evolution_client_factory: Generator[AsyncMock, None, None],
mock_evolution_client_factory: Generator[AsyncMock],
freezer: FrozenDateTimeFactory,
mode: str,
active: bool,

View File

@ -16,7 +16,7 @@ from tests.common import MockConfigEntry
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
def mock_setup_entry() -> Generator[AsyncMock]:
"""Override async_setup_entry."""
with patch(
"homeassistant.components.elevenlabs.async_setup_entry", return_value=True
@ -25,7 +25,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]:
@pytest.fixture
def mock_async_client() -> Generator[AsyncMock, None, None]:
def mock_async_client() -> Generator[AsyncMock]:
"""Override async ElevenLabs client."""
client_mock = AsyncMock()
client_mock.voices.get_all.return_value = GetVoicesResponse(voices=MOCK_VOICES)
@ -37,7 +37,7 @@ def mock_async_client() -> Generator[AsyncMock, None, None]:
@pytest.fixture
def mock_async_client_fail() -> Generator[AsyncMock, None, None]:
def mock_async_client_fail() -> Generator[AsyncMock]:
"""Override async ElevenLabs client."""
with patch(
"homeassistant.components.elevenlabs.config_flow.AsyncElevenLabs",

View File

@ -65,7 +65,7 @@ def aiohttp_client_session() -> None:
@pytest.fixture
def mock_aioclient() -> Generator[AiohttpClientMocker, None, None]:
def mock_aioclient() -> Generator[AiohttpClientMocker]:
"""Fixture to mock aioclient calls."""
with mock_aiohttp_client() as mock_session:
yield mock_session
@ -96,7 +96,7 @@ def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry:
@pytest.fixture
def mock_config_entries_async_forward_entry_setup() -> Generator[AsyncMock, None, None]:
def mock_config_entries_async_forward_entry_setup() -> Generator[AsyncMock]:
"""Mock async_forward_entry_setup."""
with patch(
"homeassistant.config_entries.ConfigEntries.async_forward_entry_setups"
@ -105,7 +105,7 @@ def mock_config_entries_async_forward_entry_setup() -> Generator[AsyncMock, None
@pytest.fixture
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
def mock_setup_entry() -> Generator[AsyncMock]:
"""Mock setting up a config entry."""
with patch(
"homeassistant.components.iotty.async_setup_entry", return_value=True
@ -114,7 +114,7 @@ def mock_setup_entry() -> Generator[AsyncMock, None, None]:
@pytest.fixture
def mock_iotty() -> Generator[None, MagicMock, None]:
def mock_iotty() -> Generator[MagicMock]:
"""Mock IottyProxy."""
with patch(
"homeassistant.components.iotty.api.IottyProxy", autospec=True
@ -123,7 +123,7 @@ def mock_iotty() -> Generator[None, MagicMock, None]:
@pytest.fixture
def mock_coordinator() -> Generator[None, MagicMock, None]:
def mock_coordinator() -> Generator[MagicMock]:
"""Mock IottyDataUpdateCoordinator."""
with patch(
"homeassistant.components.iotty.coordinator.IottyDataUpdateCoordinator",
@ -133,7 +133,7 @@ def mock_coordinator() -> Generator[None, MagicMock, None]:
@pytest.fixture
def mock_get_devices_nodevices() -> Generator[AsyncMock, None, None]:
def mock_get_devices_nodevices() -> Generator[AsyncMock]:
"""Mock for get_devices, returning two objects."""
with patch("iottycloud.cloudapi.CloudApi.get_devices") as mock_fn:
@ -141,7 +141,7 @@ def mock_get_devices_nodevices() -> Generator[AsyncMock, None, None]:
@pytest.fixture
def mock_get_devices_twolightswitches() -> Generator[AsyncMock, None, None]:
def mock_get_devices_twolightswitches() -> Generator[AsyncMock]:
"""Mock for get_devices, returning two objects."""
with patch(
@ -151,7 +151,7 @@ def mock_get_devices_twolightswitches() -> Generator[AsyncMock, None, None]:
@pytest.fixture
def mock_command_fn() -> Generator[AsyncMock, None, None]:
def mock_command_fn() -> Generator[AsyncMock]:
"""Mock for command."""
with patch("iottycloud.cloudapi.CloudApi.command", return_value=None) as mock_fn:
@ -159,7 +159,7 @@ def mock_command_fn() -> Generator[AsyncMock, None, None]:
@pytest.fixture
def mock_get_status_filled_off() -> Generator[AsyncMock, None, None]:
def mock_get_status_filled_off() -> Generator[AsyncMock]:
"""Mock setting up a get_status."""
retval = {RESULT: {STATUS: STATUS_OFF}}
@ -170,7 +170,7 @@ def mock_get_status_filled_off() -> Generator[AsyncMock, None, None]:
@pytest.fixture
def mock_get_status_filled() -> Generator[AsyncMock, None, None]:
def mock_get_status_filled() -> Generator[AsyncMock]:
"""Mock setting up a get_status."""
retval = {RESULT: {STATUS: STATUS_ON}}

View File

@ -108,7 +108,7 @@ def mock_ble_device() -> Generator[MagicMock]:
@pytest.fixture
def mock_pynecil() -> Generator[AsyncMock, None, None]:
def mock_pynecil() -> Generator[AsyncMock]:
"""Mock Pynecil library."""
with patch(
"homeassistant.components.iron_os.Pynecil", autospec=True

View File

@ -22,7 +22,7 @@ from tests.common import MockConfigEntry, snapshot_platform
@pytest.fixture(autouse=True)
async def sensor_only() -> AsyncGenerator[None, None]:
async def sensor_only() -> AsyncGenerator[None]:
"""Enable only the number platform."""
with patch(
"homeassistant.components.iron_os.PLATFORMS",

View File

@ -18,7 +18,7 @@ from tests.common import MockConfigEntry, async_fire_time_changed, snapshot_plat
@pytest.fixture(autouse=True)
async def sensor_only() -> AsyncGenerator[None, None]:
async def sensor_only() -> AsyncGenerator[None]:
"""Enable only the sensor platform."""
with patch(
"homeassistant.components.iron_os.PLATFORMS",