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ä
2020-01-03 14:47:06 +01:00
committed by Paulus Schoutsen
parent 5ad209c6fd
commit fa4fa30461
105 changed files with 241 additions and 314 deletions
+18 -37
View File
@@ -347,7 +347,7 @@ mock_mqtt_component = threadsafe_coroutine_factory(async_mock_mqtt_component)
def mock_component(hass, component):
"""Mock a component is setup."""
if component in hass.config.components:
AssertionError("Integration {} is already setup".format(component))
AssertionError(f"Integration {component} is already setup")
hass.config.components.add(component)
@@ -486,8 +486,8 @@ class MockModule:
partial_manifest=None,
):
"""Initialize the mock module."""
self.__name__ = "homeassistant.components.{}".format(domain)
self.__file__ = "homeassistant/components/{}".format(domain)
self.__name__ = f"homeassistant.components.{domain}"
self.__file__ = f"homeassistant/components/{domain}"
self.DOMAIN = domain
self.DEPENDENCIES = dependencies or []
self.REQUIREMENTS = requirements or []
@@ -728,7 +728,7 @@ def patch_yaml_files(files_dict, endswith=True):
return open(fname, encoding="utf-8")
# Not found
raise FileNotFoundError("File not found: {}".format(fname))
raise FileNotFoundError(f"File not found: {fname}")
return patch.object(yaml_loader, "open", mock_open_f, create=True)
@@ -791,9 +791,9 @@ def assert_setup_component(count, domain=None):
res = config.get(domain)
res_len = 0 if res is None else len(res)
assert res_len == count, "setup_component failed, expected {} got {}: {}".format(
count, res_len, res
)
assert (
res_len == count
), f"setup_component failed, expected {count} got {res_len}: {res}"
def init_recorder_component(hass, add_config=None):
@@ -824,9 +824,7 @@ def mock_restore_cache(hass, states):
)
data.last_states = last_states
_LOGGER.debug("Restore cache: %s", data.last_states)
assert len(data.last_states) == len(states), "Duplicate entity_id? {}".format(
states
)
assert len(data.last_states) == len(states), f"Duplicate entity_id? {states}"
async def get_restore_state_data() -> restore_state.RestoreStateData:
return data
@@ -855,7 +853,7 @@ class MockDependency:
base = MagicMock()
to_mock = {
"{}.{}".format(self.root, tom): resolve(base, tom.split("."))
f"{self.root}.{tom}": resolve(base, tom.split("."))
for tom in self.submodules
}
to_mock[self.root] = base
@@ -1017,10 +1015,7 @@ async def get_system_health_info(hass, domain):
def mock_integration(hass, module):
"""Mock an integration."""
integration = loader.Integration(
hass,
"homeassistant.components.{}".format(module.DOMAIN),
None,
module.mock_manifest(),
hass, f"homeassistant.components.{module.DOMAIN}", None, module.mock_manifest(),
)
_LOGGER.info("Adding mock integration: %s", module.DOMAIN)
@@ -1108,45 +1103,31 @@ class hashdict(dict):
return tuple(sorted(self.items()))
def __repr__(self): # noqa: D105 no docstring
return ", ".join("{0}={1}".format(str(i[0]), repr(i[1])) for i in self.__key())
return ", ".join(f"{i[0]!s}={i[1]!r}" for i in self.__key())
def __hash__(self): # noqa: D105 no docstring
return hash(self.__key())
def __setitem__(self, key, value): # noqa: D105 no docstring
raise TypeError(
"{0} does not support item assignment".format(self.__class__.__name__)
)
raise TypeError(f"{self.__class__.__name__} does not support item assignment")
def __delitem__(self, key): # noqa: D105 no docstring
raise TypeError(
"{0} does not support item assignment".format(self.__class__.__name__)
)
raise TypeError(f"{self.__class__.__name__} does not support item assignment")
def clear(self): # noqa: D102 no docstring
raise TypeError(
"{0} does not support item assignment".format(self.__class__.__name__)
)
raise TypeError(f"{self.__class__.__name__} does not support item assignment")
def pop(self, *args, **kwargs): # noqa: D102 no docstring
raise TypeError(
"{0} does not support item assignment".format(self.__class__.__name__)
)
raise TypeError(f"{self.__class__.__name__} does not support item assignment")
def popitem(self, *args, **kwargs): # noqa: D102 no docstring
raise TypeError(
"{0} does not support item assignment".format(self.__class__.__name__)
)
raise TypeError(f"{self.__class__.__name__} does not support item assignment")
def setdefault(self, *args, **kwargs): # noqa: D102 no docstring
raise TypeError(
"{0} does not support item assignment".format(self.__class__.__name__)
)
raise TypeError(f"{self.__class__.__name__} does not support item assignment")
def update(self, *args, **kwargs): # noqa: D102 no docstring
raise TypeError(
"{0} does not support item assignment".format(self.__class__.__name__)
)
raise TypeError(f"{self.__class__.__name__} does not support item assignment")
# update is not ok because it mutates the object
# __add__ is ok because it creates a new object
+1 -1
View File
@@ -155,7 +155,7 @@ class TestHDDTempSensor(unittest.TestCase):
assert len(self.hass.states.all()) == 1
state = self.hass.states.get("sensor.hd_temperature_dev_sdx1")
assert state.attributes.get("friendly_name") == "HD Temperature " + "/dev/sdx1"
assert state.attributes.get("friendly_name") == "HD Temperature /dev/sdx1"
@patch("telnetlib.Telnet", new=TelnetMock)
def test_hddtemp_multiple_disks(self):
+1 -1
View File
@@ -372,7 +372,7 @@ class TestLight(unittest.TestCase):
return StringIO(profile_data)
return real_open(path, *args, **kwargs)
profile_data = "id,x,y,brightness\n" + "group.all_lights.default,.4,.6,99\n"
profile_data = "id,x,y,brightness\ngroup.all_lights.default,.4,.6,99\n"
with mock.patch("os.path.isfile", side_effect=_mock_isfile):
with mock.patch("builtins.open", side_effect=_mock_open):
with mock_storage():
+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
+2 -2
View File
@@ -63,7 +63,7 @@ class TestUkTransportSensor(unittest.TestCase):
bus_state = self.hass.states.get("sensor.next_bus_to_wantage")
assert type(bus_state.state) == str
assert bus_state.name == "Next bus to {}".format(BUS_DIRECTION)
assert bus_state.name == f"Next bus to {BUS_DIRECTION}"
assert bus_state.attributes.get(ATTR_ATCOCODE) == BUS_ATCOCODE
assert bus_state.attributes.get(ATTR_LOCALITY) == "Harwell Campus"
assert bus_state.attributes.get(ATTR_STOP_NAME) == "Bus Station"
@@ -85,7 +85,7 @@ class TestUkTransportSensor(unittest.TestCase):
train_state = self.hass.states.get("sensor.next_train_to_WAT")
assert type(train_state.state) == str
assert train_state.name == "Next train to {}".format(TRAIN_DESTINATION_NAME)
assert train_state.name == f"Next train to {TRAIN_DESTINATION_NAME}"
assert train_state.attributes.get(ATTR_STATION_CODE) == TRAIN_STATION_CODE
assert train_state.attributes.get(ATTR_CALLING_AT) == TRAIN_DESTINATION_NAME
assert len(train_state.attributes.get(ATTR_NEXT_TRAINS)) == 25
@@ -25,9 +25,7 @@ from homeassistant.setup import async_setup_component
from tests.common import assert_setup_component, load_fixture, mock_component
scanner_path = (
"homeassistant.components.unifi_direct.device_tracker." + "UnifiDeviceScanner"
)
scanner_path = "homeassistant.components.unifi_direct.device_tracker.UnifiDeviceScanner"
@pytest.fixture(autouse=True)
@@ -118,14 +118,14 @@ async def test_if_fires_on_state_change(hass, calls):
hass.states.async_set("vacuum.entity", STATE_CLEANING)
await hass.async_block_till_done()
assert len(calls) == 1
assert calls[0].data["some"] == "cleaning - device - {} - docked - cleaning".format(
"vacuum.entity"
assert (
calls[0].data["some"] == "cleaning - device - vacuum.entity - docked - cleaning"
)
# Fake that the entity is docked
hass.states.async_set("vacuum.entity", STATE_DOCKED)
await hass.async_block_till_done()
assert len(calls) == 2
assert calls[1].data["some"] == "docked - device - {} - cleaning - docked".format(
"vacuum.entity"
assert (
calls[1].data["some"] == "docked - device - vacuum.entity - cleaning - docked"
)
+6 -8
View File
@@ -24,13 +24,13 @@ async def test_unregistering_webhook(hass, mock_client):
hass.components.webhook.async_register("test", "Test hook", webhook_id, handle)
resp = await mock_client.post("/api/webhook/{}".format(webhook_id))
resp = await mock_client.post(f"/api/webhook/{webhook_id}")
assert resp.status == 200
assert len(hooks) == 1
hass.components.webhook.async_unregister(webhook_id)
resp = await mock_client.post("/api/webhook/{}".format(webhook_id))
resp = await mock_client.post(f"/api/webhook/{webhook_id}")
assert resp.status == 200
assert len(hooks) == 1
@@ -73,9 +73,7 @@ async def test_posting_webhook_json(hass, mock_client):
hass.components.webhook.async_register("test", "Test hook", webhook_id, handle)
resp = await mock_client.post(
"/api/webhook/{}".format(webhook_id), json={"data": True}
)
resp = await mock_client.post(f"/api/webhook/{webhook_id}", json={"data": True})
assert resp.status == 200
assert len(hooks) == 1
assert hooks[0][0] is hass
@@ -94,7 +92,7 @@ async def test_posting_webhook_no_data(hass, mock_client):
hass.components.webhook.async_register("test", "Test hook", webhook_id, handle)
resp = await mock_client.post("/api/webhook/{}".format(webhook_id))
resp = await mock_client.post(f"/api/webhook/{webhook_id}")
assert resp.status == 200
assert len(hooks) == 1
assert hooks[0][0] is hass
@@ -114,7 +112,7 @@ async def test_webhook_put(hass, mock_client):
hass.components.webhook.async_register("test", "Test hook", webhook_id, handle)
resp = await mock_client.put("/api/webhook/{}".format(webhook_id))
resp = await mock_client.put(f"/api/webhook/{webhook_id}")
assert resp.status == 200
assert len(hooks) == 1
assert hooks[0][0] is hass
@@ -133,7 +131,7 @@ async def test_webhook_head(hass, mock_client):
hass.components.webhook.async_register("test", "Test hook", webhook_id, handle)
resp = await mock_client.head("/api/webhook/{}".format(webhook_id))
resp = await mock_client.head(f"/api/webhook/{webhook_id}")
assert resp.status == 200
assert len(hooks) == 1
assert hooks[0][0] is hass
+4 -5
View File
@@ -38,12 +38,11 @@ def assert_state_equals(
entity_id = get_entity_id(measure, profile)
state_obj = hass.states.get(entity_id)
assert state_obj, "Expected entity {} to exist but it did not".format(entity_id)
assert state_obj, f"Expected entity {entity_id} to exist but it did not"
assert state_obj.state == str(
expected
), "Expected {} but was {} for measure {}, {}".format(
expected, state_obj.state, measure, entity_id
assert state_obj.state == str(expected), (
f"Expected {expected} but was {state_obj.state} "
f"for measure {measure}, {entity_id}"
)
+2 -2
View File
@@ -174,7 +174,7 @@ async def test_xiaomi_exceptions(hass, caplog, mock_mirobo_errors):
async def test_xiaomi_vacuum_services(hass, caplog, mock_mirobo_is_got_error):
"""Test vacuum supported features."""
entity_name = "test_vacuum_cleaner_1"
entity_id = "{}.{}".format(DOMAIN, entity_name)
entity_id = f"{DOMAIN}.{entity_name}"
await async_setup_component(
hass,
@@ -319,7 +319,7 @@ async def test_xiaomi_vacuum_services(hass, caplog, mock_mirobo_is_got_error):
async def test_xiaomi_specific_services(hass, caplog, mock_mirobo_is_on):
"""Test vacuum supported features."""
entity_name = "test_vacuum_cleaner_2"
entity_id = "{}.{}".format(DOMAIN, entity_name)
entity_id = f"{DOMAIN}.{entity_name}"
await async_setup_component(
hass,
+1 -3
View File
@@ -129,9 +129,7 @@ async def test_connection_error_on_init(hass, caplog, valid_settings, connection
and record.name == "homeassistant.components.yessssms.notify"
):
assert (
"Connection Error, could not verify login data for '{}'".format(
"educom"
)
"Connection Error, could not verify login data for 'educom'"
in record.message
)
for record in caplog.records:
+1 -1
View File
@@ -113,7 +113,7 @@ class YahooWeatherMock:
def getWeatherImage(self, code): # pylint: disable=invalid-name
"""Create a link to weather image from yahoo code."""
return "https://l.yimg.com/a/i/us/we/52/{}.gif".format(code)
return f"https://l.yimg.com/a/i/us/we/52/{code}.gif"
class TestWeather(unittest.TestCase):
+1 -3
View File
@@ -18,9 +18,7 @@ def mock_zeroconf():
def service_update_mock(zeroconf, service, handlers):
"""Call service update handler."""
handlers[0](
zeroconf, service, "{}.{}".format("name", service), ServiceStateChange.Added
)
handlers[0](zeroconf, service, f"name.{service}", ServiceStateChange.Added)
def get_service_info_mock(service_type, name):
+3 -3
View File
@@ -110,9 +110,9 @@ async def async_build_devices(hass, zha_gateway, config_entry, cluster_ids):
[],
None,
zha_gateway,
ieee="00:15:8d:00:02:32:4f:0{}".format(counter),
manufacturer="Fake{}".format(cluster_id),
model="FakeModel{}".format(cluster_id),
ieee=f"00:15:8d:00:02:32:4f:0{counter}",
manufacturer=f"Fake{cluster_id}",
model=f"FakeModel{cluster_id}",
)
counter += 1
+9 -9
View File
@@ -459,18 +459,18 @@ async def test_value_entities(hass, mock_openzwave):
entry = ent_reg.async_get("zwave.mock_node")
assert entry is not None
assert entry.unique_id == "node-{}".format(node.node_id)
assert entry.unique_id == f"node-{node.node_id}"
node_dev_id = entry.device_id
entry = ent_reg.async_get("binary_sensor.mock_node_mock_value")
assert entry is not None
assert entry.unique_id == "{}-{}".format(node.node_id, value.object_id)
assert entry.unique_id == f"{node.node_id}-{value.object_id}"
assert entry.name is None
assert entry.device_id == node_dev_id
entry = ent_reg.async_get("binary_sensor.mock_node_mock_value_b")
assert entry is not None
assert entry.unique_id == "{}-{}".format(node.node_id, value2.object_id)
assert entry.unique_id == f"{node.node_id}-{value2.object_id}"
assert entry.name is None
assert entry.device_id != node_dev_id
device_id_b = entry.device_id
@@ -482,7 +482,7 @@ async def test_value_entities(hass, mock_openzwave):
device = dev_reg.async_get(device_id_b)
assert device is not None
assert device.name == "{} ({})".format(node.name, value2.instance)
assert device.name == f"{node.name} ({value2.instance})"
# test renaming without updating
await hass.services.async_call(
@@ -510,7 +510,7 @@ async def test_value_entities(hass, mock_openzwave):
device = dev_reg.async_get(device_id_b)
assert device is not None
assert device.name == "{} ({})".format(node.name, value2.instance)
assert device.name == f"{node.name} ({value2.instance})"
# test renaming
await hass.services.async_call(
@@ -528,11 +528,11 @@ async def test_value_entities(hass, mock_openzwave):
entry = ent_reg.async_get("zwave.new_node")
assert entry is not None
assert entry.unique_id == "node-{}".format(node.node_id)
assert entry.unique_id == f"node-{node.node_id}"
entry = ent_reg.async_get("binary_sensor.new_node_mock_value")
assert entry is not None
assert entry.unique_id == "{}-{}".format(node.node_id, value.object_id)
assert entry.unique_id == f"{node.node_id}-{value.object_id}"
device = dev_reg.async_get(node_dev_id)
assert device is not None
@@ -541,7 +541,7 @@ async def test_value_entities(hass, mock_openzwave):
device = dev_reg.async_get(device_id_b)
assert device is not None
assert device.name == "{} ({})".format(node.name, value2.instance)
assert device.name == f"{node.name} ({value2.instance})"
await hass.services.async_call(
"zwave",
@@ -557,7 +557,7 @@ async def test_value_entities(hass, mock_openzwave):
entry = ent_reg.async_get("binary_sensor.new_node_new_label")
assert entry is not None
assert entry.unique_id == "{}-{}".format(node.node_id, value.object_id)
assert entry.unique_id == f"{node.node_id}-{value.object_id}"
async def test_value_discovery_existing_entity(hass, mock_openzwave):
+2 -5
View File
@@ -59,9 +59,7 @@ def verify_cleanup():
count = len(INSTANCES)
for inst in INSTANCES:
inst.stop()
pytest.exit(
"Detected non stopped instances ({}), aborting test run".format(count)
)
pytest.exit(f"Detected non stopped instances ({count}), aborting test run")
@pytest.fixture
@@ -185,8 +183,7 @@ def hass_client(hass, aiohttp_client, hass_access_token):
async def auth_client():
"""Return an authenticated client."""
return await aiohttp_client(
hass.http.app,
headers={"Authorization": "Bearer {}".format(hass_access_token)},
hass.http.app, headers={"Authorization": f"Bearer {hass_access_token}"},
)
return auth_client
+2 -2
View File
@@ -84,7 +84,7 @@ async def test_discovery_single_instance(hass, discovery_flow_conf, source):
flow.context = {}
MockConfigEntry(domain="test").add_to_hass(hass)
result = await getattr(flow, "async_step_{}".format(source))({})
result = await getattr(flow, f"async_step_{source}")({})
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
assert result["reason"] == "single_instance_allowed"
@@ -97,7 +97,7 @@ async def test_discovery_confirmation(hass, discovery_flow_conf, source):
flow.hass = hass
flow.context = {}
result = await getattr(flow, "async_step_{}".format(source))({})
result = await getattr(flow, f"async_step_{source}")({})
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
assert result["step_id"] == "confirm"
+2 -2
View File
@@ -103,8 +103,8 @@ async def test_setup_recovers_when_setup_raises(hass):
OrderedDict(
[
(DOMAIN, {"platform": "mod1"}),
("{} 2".format(DOMAIN), {"platform": "non_exist"}),
("{} 3".format(DOMAIN), {"platform": "mod2"}),
(f"{DOMAIN} 2", {"platform": "non_exist"}),
(f"{DOMAIN} 3", {"platform": "mod2"}),
]
)
)
+2 -2
View File
@@ -541,7 +541,7 @@ async def test_setup_entry(hass):
assert await entity_platform.async_setup_entry(config_entry)
await hass.async_block_till_done()
full_name = "{}.{}".format(entity_platform.domain, config_entry.domain)
full_name = f"{entity_platform.domain}.{config_entry.domain}"
assert full_name in hass.config.components
assert len(hass.states.async_entity_ids()) == 1
assert len(registry.entities) == 1
@@ -560,7 +560,7 @@ async def test_setup_entry_platform_not_ready(hass, caplog):
with patch.object(entity_platform, "async_call_later") as mock_call_later:
assert not await ent_platform.async_setup_entry(config_entry)
full_name = "{}.{}".format(ent_platform.domain, config_entry.domain)
full_name = f"{ent_platform.domain}.{config_entry.domain}"
assert full_name not in hass.config.components
assert len(async_setup_entry.mock_calls) == 1
assert "Platform test not ready yet" in caplog.text
+1 -1
View File
@@ -62,7 +62,7 @@ async def test_loading_parallel(hass, store, hass_storage, caplog):
assert results[0] is MOCK_DATA
assert results[1] is MOCK_DATA
assert caplog.text.count("Loading data for {}".format(store.key))
assert caplog.text.count(f"Loading data for {store.key}")
async def test_saving_with_delay(hass, store, hass_storage):
+1 -1
View File
@@ -19,7 +19,7 @@ def test_temperature_not_a_number(hass):
with pytest.raises(Exception) as exception:
display_temp(hass, temp, TEMP_CELSIUS, PRECISION_HALVES)
assert "Temperature is not a number: {}".format(temp) in str(exception.value)
assert f"Temperature is not a number: {temp}" in str(exception.value)
def test_celsius_halves(hass):
+3 -3
View File
@@ -65,7 +65,7 @@ def assert_result_info(info, result, entities=None, domains=None, all_states=Fal
def test_template_equality():
"""Test template comparison and hashing."""
template_one = template.Template("{{ template_one }}")
template_one_1 = template.Template("{{ template_" + "one }}")
template_one_1 = template.Template("{{ template_one }}")
template_two = template.Template("{{ template_two }}")
assert template_one == template_one_1
@@ -486,9 +486,9 @@ def test_timestamp_custom(hass):
for inp, fmt, local, out in tests:
if fmt:
fil = "timestamp_custom('{}')".format(fmt)
fil = f"timestamp_custom('{fmt}')"
elif fmt and local:
fil = "timestamp_custom('{0}', {1})".format(fmt, local)
fil = f"timestamp_custom('{fmt}', {local})"
else:
fil = "timestamp_custom"
+1 -1
View File
@@ -35,7 +35,7 @@ _LOGGER = logging.getLogger(__name__)
def test_from_config_file(hass):
"""Test with configuration file."""
components = set(["browser", "conversation", "script"])
files = {"config.yaml": "".join("{}:\n".format(comp) for comp in components)}
files = {"config.yaml": "".join(f"{comp}:\n" for comp in components)}
with patch_yaml_files(files, True):
yield from bootstrap.async_from_config_file("config.yaml", hass)
+1 -3
View File
@@ -732,9 +732,7 @@ async def test_merge_id_schema(hass):
integration = await async_get_integration(hass, domain)
module = integration.get_component()
typ, _ = config_util._identify_config_schema(module)
assert typ == expected_type, "{} expected {}, got {}".format(
domain, expected_type, typ
)
assert typ == expected_type, f"{domain} expected {expected_type}, got {typ}"
async def test_merge_duplicate_keys(merge_log_err, hass):
+4 -5
View File
@@ -663,13 +663,12 @@ class TestStateMachine(unittest.TestCase):
def test_service_call_repr():
"""Test ServiceCall repr."""
call = ha.ServiceCall("homeassistant", "start")
assert str(call) == "<ServiceCall homeassistant.start (c:{})>".format(
call.context.id
)
assert str(call) == f"<ServiceCall homeassistant.start (c:{call.context.id})>"
call2 = ha.ServiceCall("homeassistant", "start", {"fast": "yes"})
assert str(call2) == "<ServiceCall homeassistant.start (c:{}): fast=yes>".format(
call2.context.id
assert (
str(call2)
== f"<ServiceCall homeassistant.start (c:{call2.context.id}): fast=yes>"
)
+1 -1
View File
@@ -193,7 +193,7 @@ def _get_test_integration(hass, name, config_flow):
"""Return a generated test integration."""
return loader.Integration(
hass,
"homeassistant.components.{}".format(name),
f"homeassistant.components.{name}",
None,
{
"name": name,
+1 -1
View File
@@ -327,7 +327,7 @@ class TestSetup:
"""Test that config is passed in."""
if config.get("comp_a", {}).get("valid", False):
return True
raise Exception("Config not passed in: {}".format(config))
raise Exception(f"Config not passed in: {config}")
platform = MockPlatform()