Remove unnecessary string literal concatenations (#30360)
This commit is contained in:
1 parent
cac750066a
commit
e6388e186c
183 files changed
+362
-393
No files matched your search
@@ -23,7 +23,7 @@ BASE_CONFIG = (
|
||||
"\n\n"
|
||||
)
|
||||
|
||||
BAD_CORE_CONFIG = "homeassistant:\n" " unit_system: bad\n" "\n\n"
|
||||
BAD_CORE_CONFIG = "homeassistant:\n unit_system: bad\n\n\n"
|
||||
|
||||
|
||||
def log_ha_config(conf):
|
||||
@@ -106,8 +106,7 @@ async def test_component_platform_not_found_2(hass, loop):
|
||||
async def test_package_invalid(hass, loop):
|
||||
"""Test a valid platform setup."""
|
||||
files = {
|
||||
YAML_CONFIG_FILE: BASE_CONFIG
|
||||
+ (" packages:\n" " p1:\n" ' group: ["a"]')
|
||||
YAML_CONFIG_FILE: BASE_CONFIG + (" packages:\n p1:\n" ' group: ["a"]')
|
||||
}
|
||||
with patch("os.path.isfile", return_value=True), patch_yaml_files(files):
|
||||
res = await async_check_ha_config_file(hass)
|
||||
|
||||
@@ -340,7 +340,7 @@ async def test_no_unnecessary_changes(registry):
|
||||
identifiers={("hue", "456"), ("bla", "123")},
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.helpers.device_registry" ".DeviceRegistry.async_schedule_save"
|
||||
"homeassistant.helpers.device_registry.DeviceRegistry.async_schedule_save"
|
||||
) as mock_save:
|
||||
entry2 = registry.async_get_or_create(
|
||||
config_entry_id="1234", identifiers={("hue", "456")}
|
||||
|
||||
@@ -115,7 +115,7 @@ async def test_setup_recovers_when_setup_raises(hass):
|
||||
|
||||
|
||||
@asynctest.patch(
|
||||
"homeassistant.helpers.entity_component.EntityComponent" ".async_setup_platform",
|
||||
"homeassistant.helpers.entity_component.EntityComponent.async_setup_platform",
|
||||
return_value=mock_coro(),
|
||||
)
|
||||
@asynctest.patch(
|
||||
@@ -137,7 +137,7 @@ async def test_setup_does_discovery(mock_setup_component, mock_setup, hass):
|
||||
assert ("platform_test", {}, {"msg": "discovery_info"}) == mock_setup.call_args[0]
|
||||
|
||||
|
||||
@asynctest.patch("homeassistant.helpers.entity_platform." "async_track_time_interval")
|
||||
@asynctest.patch("homeassistant.helpers.entity_platform.async_track_time_interval")
|
||||
async def test_set_scan_interval_via_config(mock_track, hass):
|
||||
"""Test the setting of the scan interval via configuration."""
|
||||
|
||||
@@ -460,5 +460,5 @@ async def test_extract_all_use_match_all(hass, caplog):
|
||||
ent.entity_id for ent in await component.async_extract_from_service(call)
|
||||
)
|
||||
assert (
|
||||
"Not passing an entity ID to a service to target all entities is " "deprecated"
|
||||
"Not passing an entity ID to a service to target all entities is deprecated"
|
||||
) not in caplog.text
|
||||
@@ -134,7 +134,7 @@ async def test_update_state_adds_entities_with_update_before_add_false(hass):
|
||||
assert not ent.update.called
|
||||
|
||||
|
||||
@asynctest.patch("homeassistant.helpers.entity_platform." "async_track_time_interval")
|
||||
@asynctest.patch("homeassistant.helpers.entity_platform.async_track_time_interval")
|
||||
async def test_set_scan_interval_via_platform(mock_track, hass):
|
||||
"""Test the setting of the scan interval via platform."""
|
||||
|
||||
|
||||
@@ -805,7 +805,7 @@ async def test_call_later(hass):
|
||||
now = datetime(2017, 12, 19, 15, 40, 0, tzinfo=dt_util.UTC)
|
||||
|
||||
with patch(
|
||||
"homeassistant.helpers.event" ".async_track_point_in_utc_time"
|
||||
"homeassistant.helpers.event.async_track_point_in_utc_time"
|
||||
) as mock, patch("homeassistant.util.dt.utcnow", return_value=now):
|
||||
async_call_later(hass, 3, action)
|
||||
|
||||
@@ -825,7 +825,7 @@ async def test_async_call_later(hass):
|
||||
now = datetime(2017, 12, 19, 15, 40, 0, tzinfo=dt_util.UTC)
|
||||
|
||||
with patch(
|
||||
"homeassistant.helpers.event" ".async_track_point_in_utc_time"
|
||||
"homeassistant.helpers.event.async_track_point_in_utc_time"
|
||||
) as mock, patch("homeassistant.util.dt.utcnow", return_value=now):
|
||||
remove = async_call_later(hass, 3, action)
|
||||
|
||||
|
||||
@@ -459,7 +459,7 @@ async def test_call_with_match_all(
|
||||
mock_entities["light.living_room"],
|
||||
]
|
||||
assert (
|
||||
"Not passing an entity ID to a service to target " "all entities is deprecated"
|
||||
"Not passing an entity ID to a service to target all entities is deprecated"
|
||||
) not in caplog.text
|
||||
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ def test_iterating_all_states(hass):
|
||||
|
||||
def test_iterating_domain_states(hass):
|
||||
"""Test iterating domain states."""
|
||||
tmpl_str = "{% for state in states.sensor %}" "{{ state.state }}{% endfor %}"
|
||||
tmpl_str = "{% for state in states.sensor %}{{ state.state }}{% endfor %}"
|
||||
|
||||
info = render_to_info(hass, tmpl_str)
|
||||
assert_result_info(info, "", domains=["sensor"])
|
||||
@@ -818,7 +818,7 @@ def test_states_function(hass):
|
||||
|
||||
|
||||
@patch(
|
||||
"homeassistant.helpers.template.TemplateEnvironment." "is_safe_callable",
|
||||
"homeassistant.helpers.template.TemplateEnvironment.is_safe_callable",
|
||||
return_value=True,
|
||||
)
|
||||
def test_now(mock_is_safe, hass):
|
||||
@@ -832,7 +832,7 @@ def test_now(mock_is_safe, hass):
|
||||
|
||||
|
||||
@patch(
|
||||
"homeassistant.helpers.template.TemplateEnvironment." "is_safe_callable",
|
||||
"homeassistant.helpers.template.TemplateEnvironment.is_safe_callable",
|
||||
return_value=True,
|
||||
)
|
||||
def test_utcnow(mock_is_safe, hass):
|
||||
@@ -1260,18 +1260,18 @@ async def test_expand(hass):
|
||||
hass.states.async_set("test.object", "happy")
|
||||
|
||||
info = render_to_info(
|
||||
hass, "{{ expand('test.object') | map(attribute='entity_id')" " | join(', ') }}"
|
||||
hass, "{{ expand('test.object') | map(attribute='entity_id') | join(', ') }}"
|
||||
)
|
||||
assert_result_info(info, "test.object", [])
|
||||
|
||||
info = render_to_info(
|
||||
hass,
|
||||
"{{ expand('group.new_group') | map(attribute='entity_id')" " | join(', ') }}",
|
||||
"{{ expand('group.new_group') | map(attribute='entity_id') | join(', ') }}",
|
||||
)
|
||||
assert_result_info(info, "", ["group.new_group"])
|
||||
|
||||
info = render_to_info(
|
||||
hass, "{{ expand(states.group) | map(attribute='entity_id')" " | join(', ') }}"
|
||||
hass, "{{ expand(states.group) | map(attribute='entity_id') | join(', ') }}"
|
||||
)
|
||||
assert_result_info(info, "", [], ["group"])
|
||||
|
||||
@@ -1279,12 +1279,12 @@ async def test_expand(hass):
|
||||
|
||||
info = render_to_info(
|
||||
hass,
|
||||
"{{ expand('group.new_group') | map(attribute='entity_id')" " | join(', ') }}",
|
||||
"{{ expand('group.new_group') | map(attribute='entity_id') | join(', ') }}",
|
||||
)
|
||||
assert_result_info(info, "test.object", ["group.new_group"])
|
||||
|
||||
info = render_to_info(
|
||||
hass, "{{ expand(states.group) | map(attribute='entity_id')" " | join(', ') }}"
|
||||
hass, "{{ expand(states.group) | map(attribute='entity_id') | join(', ') }}"
|
||||
)
|
||||
assert_result_info(info, "test.object", ["group.new_group"], ["group"])
|
||||
|
||||
@@ -1437,7 +1437,7 @@ def test_closest_function_to_state(hass):
|
||||
|
||||
assert (
|
||||
template.Template(
|
||||
"{{ closest(states.zone.far_away, " "states.test_domain).entity_id }}", hass
|
||||
"{{ closest(states.zone.far_away, states.test_domain).entity_id }}", hass
|
||||
).async_render()
|
||||
== "test_domain.closest_zone"
|
||||
)
|
||||
@@ -1471,7 +1471,7 @@ def test_closest_function_state_with_invalid_location(hass):
|
||||
|
||||
assert (
|
||||
template.Template(
|
||||
"{{ closest(states.test_domain.closest_home, " "states) }}", hass
|
||||
"{{ closest(states.test_domain.closest_home, states) }}", hass
|
||||
).async_render()
|
||||
== "None"
|
||||
)
|
||||
@@ -1517,7 +1517,7 @@ def test_extract_entities_none_exclude_stuff(hass):
|
||||
|
||||
assert (
|
||||
template.extract_entities(
|
||||
"{{ closest(states.zone.far_away, " "states.test_domain).entity_id }}"
|
||||
"{{ closest(states.zone.far_away, states.test_domain).entity_id }}"
|
||||
)
|
||||
== MATCH_ALL
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user