mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 11:29:46 +00:00
Add type hints to integration tests (part 15) (#88006)
This commit is contained in:
@@ -146,7 +146,7 @@ SLAVE_UNIQUE_ID = "ground_floor_sensor"
|
||||
},
|
||||
],
|
||||
)
|
||||
async def test_config_sensor(hass, mock_modbus):
|
||||
async def test_config_sensor(hass: HomeAssistant, mock_modbus) -> None:
|
||||
"""Run configuration test for sensor."""
|
||||
assert SENSOR_DOMAIN in hass.config.components
|
||||
|
||||
@@ -247,7 +247,9 @@ async def test_config_sensor(hass, mock_modbus):
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_config_wrong_struct_sensor(hass, error_message, mock_modbus, caplog):
|
||||
async def test_config_wrong_struct_sensor(
|
||||
hass: HomeAssistant, error_message, mock_modbus, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
"""Run test for sensor with wrong struct."""
|
||||
messages = str([x.message for x in caplog.get_records("setup")])
|
||||
assert error_message in messages
|
||||
@@ -586,7 +588,7 @@ async def test_config_wrong_struct_sensor(hass, error_message, mock_modbus, capl
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_all_sensor(hass, mock_do_cycle, expected):
|
||||
async def test_all_sensor(hass: HomeAssistant, mock_do_cycle, expected) -> None:
|
||||
"""Run test for sensor."""
|
||||
assert hass.states.get(ENTITY_ID).state == expected
|
||||
|
||||
@@ -673,7 +675,7 @@ async def test_all_sensor(hass, mock_do_cycle, expected):
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_slave_sensor(hass, mock_do_cycle, expected):
|
||||
async def test_slave_sensor(hass: HomeAssistant, mock_do_cycle, expected) -> None:
|
||||
"""Run test for sensor."""
|
||||
assert hass.states.get(ENTITY_ID).state == expected[0]
|
||||
entity_registry = er.async_get(hass)
|
||||
@@ -717,7 +719,7 @@ async def test_slave_sensor(hass, mock_do_cycle, expected):
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_wrong_unpack(hass, mock_do_cycle):
|
||||
async def test_wrong_unpack(hass: HomeAssistant, mock_do_cycle) -> None:
|
||||
"""Run test for sensor."""
|
||||
assert hass.states.get(ENTITY_ID).state == STATE_UNAVAILABLE
|
||||
|
||||
@@ -748,7 +750,9 @@ async def test_wrong_unpack(hass, mock_do_cycle):
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_lazy_error_sensor(hass, mock_do_cycle, start_expect, end_expect):
|
||||
async def test_lazy_error_sensor(
|
||||
hass: HomeAssistant, mock_do_cycle, start_expect, end_expect
|
||||
) -> None:
|
||||
"""Run test for sensor."""
|
||||
hass.states.async_set(ENTITY_ID, 17)
|
||||
await hass.async_block_till_done()
|
||||
@@ -809,7 +813,7 @@ async def test_lazy_error_sensor(hass, mock_do_cycle, start_expect, end_expect):
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_struct_sensor(hass, mock_do_cycle, expected):
|
||||
async def test_struct_sensor(hass: HomeAssistant, mock_do_cycle, expected) -> None:
|
||||
"""Run test for sensor struct."""
|
||||
assert hass.states.get(ENTITY_ID).state == expected
|
||||
|
||||
@@ -887,7 +891,7 @@ async def test_struct_sensor(hass, mock_do_cycle, expected):
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_wrap_sensor(hass, mock_do_cycle, expected):
|
||||
async def test_wrap_sensor(hass: HomeAssistant, mock_do_cycle, expected) -> None:
|
||||
"""Run test for sensor struct."""
|
||||
assert hass.states.get(ENTITY_ID).state == expected
|
||||
|
||||
@@ -921,7 +925,9 @@ async def test_wrap_sensor(hass, mock_do_cycle, expected):
|
||||
},
|
||||
],
|
||||
)
|
||||
async def test_restore_state_sensor(hass, mock_test_state, mock_modbus):
|
||||
async def test_restore_state_sensor(
|
||||
hass: HomeAssistant, mock_test_state, mock_modbus
|
||||
) -> None:
|
||||
"""Run test for sensor restore state."""
|
||||
assert hass.states.get(ENTITY_ID).state == mock_test_state[0].state
|
||||
|
||||
@@ -940,7 +946,7 @@ async def test_restore_state_sensor(hass, mock_test_state, mock_modbus):
|
||||
},
|
||||
],
|
||||
)
|
||||
async def test_service_sensor_update(hass, mock_modbus, mock_ha):
|
||||
async def test_service_sensor_update(hass: HomeAssistant, mock_modbus, mock_ha) -> None:
|
||||
"""Run test for service homeassistant.update_entity."""
|
||||
mock_modbus.read_input_registers.return_value = ReadResult([27])
|
||||
await hass.services.async_call(
|
||||
|
||||
Reference in New Issue
Block a user