mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Align code styling in Vodafone Station tests (#141745)
This commit is contained in:
parent
20e2de200f
commit
43b83c855f
@ -40,8 +40,7 @@ async def test_coordinator_device_cleanup(
|
||||
|
||||
device_tracker = f"device_tracker.{DEVICE_1_HOST}"
|
||||
|
||||
state = hass.states.get(device_tracker)
|
||||
assert state is not None
|
||||
assert hass.states.get(device_tracker)
|
||||
|
||||
mock_vodafone_station_router.get_devices_data.return_value = {
|
||||
DEVICE_2_MAC: VodafoneStationDevice(
|
||||
@ -59,10 +58,10 @@ async def test_coordinator_device_cleanup(
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(device_tracker)
|
||||
assert state is None
|
||||
assert hass.states.get(device_tracker) is None
|
||||
assert f"Skipping entity {DEVICE_2_HOST}" in caplog.text
|
||||
|
||||
device = device_registry.async_get_device(identifiers={(DOMAIN, DEVICE_1_MAC)})
|
||||
assert device is None
|
||||
assert (
|
||||
device_registry.async_get_device(identifiers={(DOMAIN, DEVICE_1_MAC)}) is None
|
||||
)
|
||||
assert f"Removing device: {DEVICE_1_HOST}" in caplog.text
|
||||
|
@ -47,8 +47,7 @@ async def test_consider_home(
|
||||
|
||||
device_tracker = f"device_tracker.{DEVICE_1_HOST}"
|
||||
|
||||
state = hass.states.get(device_tracker)
|
||||
assert state
|
||||
assert (state := hass.states.get(device_tracker))
|
||||
assert state.state == STATE_HOME
|
||||
|
||||
mock_vodafone_station_router.get_devices_data.return_value[
|
||||
@ -59,6 +58,5 @@ async def test_consider_home(
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(device_tracker)
|
||||
assert state
|
||||
assert (state := hass.states.get(device_tracker))
|
||||
assert state.state == STATE_NOT_HOME
|
||||
|
@ -55,8 +55,7 @@ async def test_active_connection_type(
|
||||
|
||||
active_connection_entity = "sensor.vodafone_station_m123456789_active_connection"
|
||||
|
||||
state = hass.states.get(active_connection_entity)
|
||||
assert state
|
||||
assert (state := hass.states.get(active_connection_entity))
|
||||
assert state.state == STATE_UNKNOWN
|
||||
|
||||
mock_vodafone_station_router.get_sensor_data.return_value[connection_type] = (
|
||||
@ -67,8 +66,7 @@ async def test_active_connection_type(
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(active_connection_entity)
|
||||
assert state
|
||||
assert (state := hass.states.get(active_connection_entity))
|
||||
assert state.state == LINE_TYPES[index]
|
||||
|
||||
|
||||
@ -85,8 +83,7 @@ async def test_uptime(
|
||||
uptime = "2024-11-19T20:19:00+00:00"
|
||||
uptime_entity = "sensor.vodafone_station_m123456789_uptime"
|
||||
|
||||
state = hass.states.get(uptime_entity)
|
||||
assert state
|
||||
assert (state := hass.states.get(uptime_entity))
|
||||
assert state.state == uptime
|
||||
|
||||
mock_vodafone_station_router.get_sensor_data.return_value["sys_uptime"] = "12:17:23"
|
||||
@ -95,8 +92,7 @@ async def test_uptime(
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get(uptime_entity)
|
||||
assert state
|
||||
assert (state := hass.states.get(uptime_entity))
|
||||
assert state.state == uptime
|
||||
|
||||
|
||||
@ -124,6 +120,5 @@ async def test_coordinator_client_connector_error(
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
state = hass.states.get("sensor.vodafone_station_m123456789_uptime")
|
||||
assert state
|
||||
assert (state := hass.states.get("sensor.vodafone_station_m123456789_uptime"))
|
||||
assert state.state == STATE_UNAVAILABLE
|
||||
|
Loading…
x
Reference in New Issue
Block a user