1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Add type hints to integration tests (part 15) (#88006)

This commit is contained in:
epenet
2023-02-15 10:00:49 +01:00
committed by GitHub
parent 6c23d6abfe
commit 50cbabb2d8
51 changed files with 896 additions and 427 deletions

View File

@@ -63,7 +63,7 @@ ENTITY_ID2 = f"{ENTITY_ID}_2"
},
],
)
async def test_config_cover(hass, mock_modbus):
async def test_config_cover(hass: HomeAssistant, mock_modbus) -> None:
"""Run configuration test for cover."""
assert COVER_DOMAIN in hass.config.components
@@ -108,7 +108,7 @@ async def test_config_cover(hass, mock_modbus):
),
],
)
async def test_coil_cover(hass, expected, mock_do_cycle):
async def test_coil_cover(hass: HomeAssistant, expected, mock_do_cycle) -> None:
"""Run test for given config."""
assert hass.states.get(ENTITY_ID).state == expected
@@ -141,7 +141,9 @@ async def test_coil_cover(hass, expected, mock_do_cycle):
),
],
)
async def test_lazy_error_cover(hass, start_expect, end_expect, mock_do_cycle):
async def test_lazy_error_cover(
hass: HomeAssistant, start_expect, end_expect, mock_do_cycle
) -> None:
"""Run test for given config."""
now = mock_do_cycle
assert hass.states.get(ENTITY_ID).state == start_expect
@@ -190,7 +192,7 @@ async def test_lazy_error_cover(hass, start_expect, end_expect, mock_do_cycle):
),
],
)
async def test_register_cover(hass, expected, mock_do_cycle):
async def test_register_cover(hass: HomeAssistant, expected, mock_do_cycle) -> None:
"""Run test for given config."""
assert hass.states.get(ENTITY_ID).state == expected
@@ -209,7 +211,7 @@ async def test_register_cover(hass, expected, mock_do_cycle):
},
],
)
async def test_service_cover_update(hass, mock_modbus, mock_ha):
async def test_service_cover_update(hass: HomeAssistant, mock_modbus, mock_ha) -> None:
"""Run test for service homeassistant.update_entity."""
await hass.services.async_call(
"homeassistant", "update_entity", {"entity_id": ENTITY_ID}, blocking=True
@@ -253,7 +255,9 @@ async def test_service_cover_update(hass, mock_modbus, mock_ha):
},
],
)
async def test_restore_state_cover(hass, mock_test_state, mock_modbus):
async def test_restore_state_cover(
hass: HomeAssistant, mock_test_state, mock_modbus
) -> None:
"""Run test for cover restore state."""
test_state = mock_test_state[0].state
assert hass.states.get(ENTITY_ID).state == test_state
@@ -280,7 +284,7 @@ async def test_restore_state_cover(hass, mock_test_state, mock_modbus):
},
],
)
async def test_service_cover_move(hass, mock_modbus, mock_ha):
async def test_service_cover_move(hass: HomeAssistant, mock_modbus, mock_ha) -> None:
"""Run test for service homeassistant.update_entity."""
mock_modbus.read_holding_registers.return_value = ReadResult([0x01])