Improve string formatting v6 (#33698)
This commit is contained in:
1 parent
d7e3b0b755
commit
eae21be5b9
43 files changed
+81
-87
No files matched your search
@@ -40,7 +40,7 @@ async def test_entity_state(hass, device_factory):
|
||||
await setup_platform(hass, BINARY_SENSOR_DOMAIN, devices=[device])
|
||||
state = hass.states.get("binary_sensor.motion_sensor_1_motion")
|
||||
assert state.state == "off"
|
||||
assert state.attributes[ATTR_FRIENDLY_NAME] == device.label + " " + Attribute.motion
|
||||
assert state.attributes[ATTR_FRIENDLY_NAME] == f"{device.label} {Attribute.motion}"
|
||||
|
||||
|
||||
async def test_entity_and_device_attributes(hass, device_factory):
|
||||
@@ -56,7 +56,7 @@ async def test_entity_and_device_attributes(hass, device_factory):
|
||||
# Assert
|
||||
entry = entity_registry.async_get("binary_sensor.motion_sensor_1_motion")
|
||||
assert entry
|
||||
assert entry.unique_id == device.device_id + "." + Attribute.motion
|
||||
assert entry.unique_id == f"{device.device_id}.{Attribute.motion}"
|
||||
entry = device_registry.async_get_device({(DOMAIN, device.device_id)}, [])
|
||||
assert entry
|
||||
assert entry.name == device.label
|
||||
|
||||
@@ -84,7 +84,7 @@ async def test_entity_and_device_attributes(hass, device_factory):
|
||||
# Assert
|
||||
entry = entity_registry.async_get("sensor.sensor_1_battery")
|
||||
assert entry
|
||||
assert entry.unique_id == f"{device.device_id}." + Attribute.battery
|
||||
assert entry.unique_id == f"{device.device_id}.{Attribute.battery}"
|
||||
entry = device_registry.async_get_device({(DOMAIN, device.device_id)}, [])
|
||||
assert entry
|
||||
assert entry.name == device.label
|
||||
|
||||
Reference in new issue
Block a user