mirror of
https://github.com/home-assistant/core.git
synced 2026-02-15 07:36:16 +00:00
Improve smarla typing in tests (#162163)
This commit is contained in:
@@ -93,11 +93,15 @@ async def test_number_state_update(
|
||||
|
||||
entity_id = entity_info["entity_id"]
|
||||
|
||||
assert hass.states.get(entity_id).state == "1.0"
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.state == "1.0"
|
||||
|
||||
mock_number_property.get.return_value = 100
|
||||
|
||||
await update_property_listeners(mock_number_property)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get(entity_id).state == "100.0"
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.state == "100.0"
|
||||
|
||||
@@ -75,11 +75,15 @@ async def test_sensor_state_update(
|
||||
|
||||
entity_id = entity_info["entity_id"]
|
||||
|
||||
assert hass.states.get(entity_id).state == "0"
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.state == "0"
|
||||
|
||||
mock_sensor_property.get.return_value = entity_info["test_value"]
|
||||
|
||||
await update_property_listeners(mock_sensor_property)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get(entity_id).state == "1"
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.state == "1"
|
||||
|
||||
@@ -104,11 +104,15 @@ async def test_switch_state_update(
|
||||
|
||||
entity_id = entity_info["entity_id"]
|
||||
|
||||
assert hass.states.get(entity_id).state == STATE_OFF
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.state == STATE_OFF
|
||||
|
||||
mock_switch_property.get.return_value = True
|
||||
|
||||
await update_property_listeners(mock_switch_property)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get(entity_id).state == STATE_ON
|
||||
state = hass.states.get(entity_id)
|
||||
assert state is not None
|
||||
assert state.state == STATE_ON
|
||||
|
||||
Reference in New Issue
Block a user