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
@@ -78,7 +78,7 @@ async def expires_helper(hass, mqtt_mock, caplog):
|
||||
"""Run the basic expiry code."""
|
||||
|
||||
now = datetime(2017, 1, 1, 1, tzinfo=dt_util.UTC)
|
||||
with patch(("homeassistant.helpers.event." "dt_util.utcnow"), return_value=now):
|
||||
with patch(("homeassistant.helpers.event.dt_util.utcnow"), return_value=now):
|
||||
async_fire_time_changed(hass, now)
|
||||
async_fire_mqtt_message(hass, "test-topic", "ON")
|
||||
await hass.async_block_till_done()
|
||||
@@ -97,7 +97,7 @@ async def expires_helper(hass, mqtt_mock, caplog):
|
||||
assert state.state == STATE_ON
|
||||
|
||||
# Next message resets timer
|
||||
with patch(("homeassistant.helpers.event." "dt_util.utcnow"), return_value=now):
|
||||
with patch(("homeassistant.helpers.event.dt_util.utcnow"), return_value=now):
|
||||
async_fire_time_changed(hass, now)
|
||||
async_fire_mqtt_message(hass, "test-topic", "OFF")
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -113,7 +113,7 @@ async def test_set_operation_bad_attr_and_state(hass, mqtt_mock, caplog):
|
||||
assert state.state == "off"
|
||||
with pytest.raises(vol.Invalid) as excinfo:
|
||||
await common.async_set_hvac_mode(hass, None, ENTITY_CLIMATE)
|
||||
assert ("value is not allowed for dictionary value @ " "data['hvac_mode']") in str(
|
||||
assert ("value is not allowed for dictionary value @ data['hvac_mode']") in str(
|
||||
excinfo.value
|
||||
)
|
||||
state = hass.states.get(ENTITY_CLIMATE)
|
||||
|
||||
@@ -27,7 +27,7 @@ async def test_ensure_device_tracker_platform_validation(hass):
|
||||
assert "qos" in config
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.mqtt.device_tracker." "async_setup_scanner",
|
||||
"homeassistant.components.mqtt.device_tracker.async_setup_scanner",
|
||||
autospec=True,
|
||||
side_effect=mock_setup_scanner,
|
||||
) as mock_sp:
|
||||
|
||||
@@ -179,9 +179,7 @@ async def test_discovery_incl_nodeid(hass, mqtt_mock, caplog):
|
||||
await async_start(hass, "homeassistant", {}, entry)
|
||||
|
||||
async_fire_mqtt_message(
|
||||
hass,
|
||||
"homeassistant/binary_sensor/my_node_id/bla" "/config",
|
||||
'{ "name": "Beer" }',
|
||||
hass, "homeassistant/binary_sensor/my_node_id/bla/config", '{ "name": "Beer" }',
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -212,7 +210,7 @@ async def test_non_duplicate_discovery(hass, mqtt_mock, caplog):
|
||||
assert state is not None
|
||||
assert state.name == "Beer"
|
||||
assert state_duplicate is None
|
||||
assert "Component has already been discovered: " "binary_sensor bla" in caplog.text
|
||||
assert "Component has already been discovered: binary_sensor bla" in caplog.text
|
||||
|
||||
|
||||
async def test_discovery_expansion(hass, mqtt_mock, caplog):
|
||||
@@ -424,7 +422,7 @@ async def test_complex_discovery_topic_prefix(hass, mqtt_mock, caplog):
|
||||
|
||||
async_fire_mqtt_message(
|
||||
hass,
|
||||
("my_home/homeassistant/register" "/binary_sensor/node1/object1/config"),
|
||||
("my_home/homeassistant/register/binary_sensor/node1/object1/config"),
|
||||
'{ "name": "Beer" }',
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -555,7 +555,7 @@ async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
|
||||
},
|
||||
)
|
||||
with patch(
|
||||
"homeassistant.helpers.restore_state.RestoreEntity" ".async_get_last_state",
|
||||
"homeassistant.helpers.restore_state.RestoreEntity.async_get_last_state",
|
||||
return_value=mock_coro(fake_state),
|
||||
):
|
||||
with assert_setup_component(1, light.DOMAIN):
|
||||
|
||||
@@ -299,7 +299,7 @@ async def test_sending_mqtt_commands_and_optimistic(hass, mqtt_mock):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"homeassistant.helpers.restore_state.RestoreEntity" ".async_get_last_state",
|
||||
"homeassistant.helpers.restore_state.RestoreEntity.async_get_last_state",
|
||||
return_value=mock_coro(fake_state),
|
||||
):
|
||||
assert await async_setup_component(
|
||||
|
||||
@@ -261,7 +261,7 @@ async def test_optimistic(hass, mqtt_mock):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"homeassistant.helpers.restore_state.RestoreEntity" ".async_get_last_state",
|
||||
"homeassistant.helpers.restore_state.RestoreEntity.async_get_last_state",
|
||||
return_value=mock_coro(fake_state),
|
||||
):
|
||||
with assert_setup_component(1, light.DOMAIN):
|
||||
|
||||
@@ -63,7 +63,7 @@ async def test_setting_sensor_value_expires(hass, mqtt_mock, caplog):
|
||||
assert state.state == "unknown"
|
||||
|
||||
now = datetime(2017, 1, 1, 1, tzinfo=dt_util.UTC)
|
||||
with patch(("homeassistant.helpers.event." "dt_util.utcnow"), return_value=now):
|
||||
with patch(("homeassistant.helpers.event.dt_util.utcnow"), return_value=now):
|
||||
async_fire_time_changed(hass, now)
|
||||
async_fire_mqtt_message(hass, "test-topic", "100")
|
||||
await hass.async_block_till_done()
|
||||
@@ -82,7 +82,7 @@ async def test_setting_sensor_value_expires(hass, mqtt_mock, caplog):
|
||||
assert state.state == "100"
|
||||
|
||||
# Next message resets timer
|
||||
with patch(("homeassistant.helpers.event." "dt_util.utcnow"), return_value=now):
|
||||
with patch(("homeassistant.helpers.event.dt_util.utcnow"), return_value=now):
|
||||
async_fire_time_changed(hass, now)
|
||||
async_fire_mqtt_message(hass, "test-topic", "101")
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@@ -69,7 +69,7 @@ async def test_sending_mqtt_commands_and_optimistic(hass, mock_publish):
|
||||
fake_state = ha.State("switch.test", "on")
|
||||
|
||||
with patch(
|
||||
"homeassistant.helpers.restore_state.RestoreEntity" ".async_get_last_state",
|
||||
"homeassistant.helpers.restore_state.RestoreEntity.async_get_last_state",
|
||||
return_value=mock_coro(fake_state),
|
||||
):
|
||||
assert await async_setup_component(
|
||||
|
||||
Reference in new issue
Block a user