Various string cleanups (#30435)

* Remove some unnecessary string concatenations

* Replace some simple str.formats with f-strings

* Replace some string concatenations with f-strings
This commit is contained in:
Ville Skyttä authored and Paulus Schoutsen committed 2020-01-03 14:47:06 +01:00
1 parent 5ad209c6fd
commit fa4fa30461
105 files changed
+241 -314

No files matched your search

+5 -5
View File
@@ -156,12 +156,12 @@ def mock_light(test_features={}, test_state={}, n=0):
mock_light_data = Mock(**test_state)
mock_light = Mock(
id="mock-light-id-{}".format(n),
id=f"mock-light-id-{n}",
reachable=True,
observe=Mock(),
device_info=MagicMock(),
)
mock_light.name = "tradfri_light_{}".format(n)
mock_light.name = f"tradfri_light_{n}"
# Set supported features for the light.
features = {**DEFAULT_TEST_FEATURES, **test_features}
@@ -258,7 +258,7 @@ async def test_turn_on(
await hass.services.async_call(
"light",
"turn_on",
{"entity_id": "light.tradfri_light_{}".format(id), **test_data},
{"entity_id": f"light.tradfri_light_{id}", **test_data},
blocking=True,
)
await hass.async_block_till_done()
@@ -286,7 +286,7 @@ async def test_turn_on(
await hass.async_block_till_done()
# Check that the state is correct.
states = hass.states.get("light.tradfri_light_{}".format(id))
states = hass.states.get(f"light.tradfri_light_{id}")
for k, v in expected_result.items():
if k == "state":
assert states.state == v
@@ -342,7 +342,7 @@ def mock_group(test_state={}, n=0):
state = {**default_state, **test_state}
mock_group = Mock(member_ids=[], observe=Mock(), **state)
mock_group.name = "tradfri_group_{}".format(n)
mock_group.name = f"tradfri_group_{n}"
return mock_group