mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Rename variable in sensor tests (#122954)
This commit is contained in:
parent
a23b3f84f0
commit
177690bcb3
@ -2466,30 +2466,29 @@ async def test_list_statistic_ids(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"_attributes",
|
"energy_attributes",
|
||||||
[{**ENERGY_SENSOR_ATTRIBUTES, "last_reset": 0}, TEMPERATURE_SENSOR_ATTRIBUTES],
|
[{**ENERGY_SENSOR_ATTRIBUTES, "last_reset": 0}, TEMPERATURE_SENSOR_ATTRIBUTES],
|
||||||
)
|
)
|
||||||
async def test_list_statistic_ids_unsupported(
|
async def test_list_statistic_ids_unsupported(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
caplog: pytest.LogCaptureFixture,
|
energy_attributes: dict[str, Any],
|
||||||
_attributes,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test listing future statistic ids for unsupported sensor."""
|
"""Test listing future statistic ids for unsupported sensor."""
|
||||||
await async_setup_component(hass, "sensor", {})
|
await async_setup_component(hass, "sensor", {})
|
||||||
# Wait for the sensor recorder platform to be added
|
# Wait for the sensor recorder platform to be added
|
||||||
await async_recorder_block_till_done(hass)
|
await async_recorder_block_till_done(hass)
|
||||||
attributes = dict(_attributes)
|
attributes = dict(energy_attributes)
|
||||||
hass.states.async_set("sensor.test1", 0, attributes=attributes)
|
hass.states.async_set("sensor.test1", 0, attributes=attributes)
|
||||||
if "last_reset" in attributes:
|
if "last_reset" in attributes:
|
||||||
attributes.pop("unit_of_measurement")
|
attributes.pop("unit_of_measurement")
|
||||||
hass.states.async_set("last_reset.test2", 0, attributes=attributes)
|
hass.states.async_set("last_reset.test2", 0, attributes=attributes)
|
||||||
attributes = dict(_attributes)
|
attributes = dict(energy_attributes)
|
||||||
if "unit_of_measurement" in attributes:
|
if "unit_of_measurement" in attributes:
|
||||||
attributes["unit_of_measurement"] = "invalid"
|
attributes["unit_of_measurement"] = "invalid"
|
||||||
hass.states.async_set("sensor.test3", 0, attributes=attributes)
|
hass.states.async_set("sensor.test3", 0, attributes=attributes)
|
||||||
attributes.pop("unit_of_measurement")
|
attributes.pop("unit_of_measurement")
|
||||||
hass.states.async_set("sensor.test4", 0, attributes=attributes)
|
hass.states.async_set("sensor.test4", 0, attributes=attributes)
|
||||||
attributes = dict(_attributes)
|
attributes = dict(energy_attributes)
|
||||||
attributes["state_class"] = "invalid"
|
attributes["state_class"] = "invalid"
|
||||||
hass.states.async_set("sensor.test5", 0, attributes=attributes)
|
hass.states.async_set("sensor.test5", 0, attributes=attributes)
|
||||||
attributes.pop("state_class")
|
attributes.pop("state_class")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user