Mark base components' state_attribute @final, rename others to extra_state_attributes (#48161)
* Mark base state_attributes @final, rename others to extra_state_attributes * Fix calendar, update tests
This commit is contained in:
parent
668d018e9c
commit
346a724ac3
52 changed files with 106 additions and 71 deletions
|
@ -58,7 +58,7 @@ async def test_valid_data(hass):
|
|||
State(GOOD_CONFIG["sensors"][reading], value),
|
||||
)
|
||||
assert sensor.state == "ok"
|
||||
attrib = sensor.state_attributes
|
||||
attrib = sensor.extra_state_attributes
|
||||
for reading, value in GOOD_DATA.items():
|
||||
# battery level has a different name in
|
||||
# the JSON format than in hass
|
||||
|
@ -70,13 +70,13 @@ async def test_low_battery(hass):
|
|||
sensor = plant.Plant("other plant", GOOD_CONFIG)
|
||||
sensor.entity_id = "sensor.mqtt_plant_battery"
|
||||
sensor.hass = hass
|
||||
assert sensor.state_attributes["problem"] == "none"
|
||||
assert sensor.extra_state_attributes["problem"] == "none"
|
||||
sensor.state_changed(
|
||||
"sensor.mqtt_plant_battery",
|
||||
State("sensor.mqtt_plant_battery", 10),
|
||||
)
|
||||
assert sensor.state == "problem"
|
||||
assert sensor.state_attributes["problem"] == "battery low"
|
||||
assert sensor.extra_state_attributes["problem"] == "battery low"
|
||||
|
||||
|
||||
async def test_initial_states(hass):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue