mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +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(
|
||||
"_attributes",
|
||||
"energy_attributes",
|
||||
[{**ENERGY_SENSOR_ATTRIBUTES, "last_reset": 0}, TEMPERATURE_SENSOR_ATTRIBUTES],
|
||||
)
|
||||
async def test_list_statistic_ids_unsupported(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
_attributes,
|
||||
energy_attributes: dict[str, Any],
|
||||
) -> None:
|
||||
"""Test listing future statistic ids for unsupported sensor."""
|
||||
await async_setup_component(hass, "sensor", {})
|
||||
# Wait for the sensor recorder platform to be added
|
||||
await async_recorder_block_till_done(hass)
|
||||
attributes = dict(_attributes)
|
||||
attributes = dict(energy_attributes)
|
||||
hass.states.async_set("sensor.test1", 0, attributes=attributes)
|
||||
if "last_reset" in attributes:
|
||||
attributes.pop("unit_of_measurement")
|
||||
hass.states.async_set("last_reset.test2", 0, attributes=attributes)
|
||||
attributes = dict(_attributes)
|
||||
attributes = dict(energy_attributes)
|
||||
if "unit_of_measurement" in attributes:
|
||||
attributes["unit_of_measurement"] = "invalid"
|
||||
hass.states.async_set("sensor.test3", 0, attributes=attributes)
|
||||
attributes.pop("unit_of_measurement")
|
||||
hass.states.async_set("sensor.test4", 0, attributes=attributes)
|
||||
attributes = dict(_attributes)
|
||||
attributes = dict(energy_attributes)
|
||||
attributes["state_class"] = "invalid"
|
||||
hass.states.async_set("sensor.test5", 0, attributes=attributes)
|
||||
attributes.pop("state_class")
|
||||
|
Loading…
x
Reference in New Issue
Block a user