Skip to content

Commit b127ed9

Browse files
committed
fix for odler versions
1 parent 96bbbe0 commit b127ed9

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

tests/test_switch.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
STATE_OFF,
9797
STATE_ON,
9898
)
99+
from homeassistant.const import __version__ as ha_version
99100
from homeassistant.core import Context, Event, HomeAssistant, State
100101
from homeassistant.helpers import area_registry as ar
101102
from homeassistant.helpers import entity_registry
@@ -1340,17 +1341,20 @@ def mock_area_registry(
13401341
"""Mock the Area Registry."""
13411342
registry = ar.AreaRegistry(hass)
13421343
registry._area_data = {}
1343-
area_in_floor = ar.AreaEntry(
1344-
id="test-area",
1345-
name="Test area",
1346-
aliases={},
1347-
normalized_name="test-area",
1348-
floor_id="test-floor",
1349-
icon=None,
1350-
picture=None,
1351-
)
1344+
area_kwargs = {
1345+
"name": "Test Area",
1346+
"normalized_name": "test-area",
1347+
"aliases": {},
1348+
"id": "test-area",
1349+
"picture": None,
1350+
}
1351+
year, month = (int(x) for x in ha_version.split(".")[:2])
1352+
if year >= 2024 and month >= 3:
1353+
area_kwargs["icon"] = None
1354+
area_kwargs["floor_id"] = "test-floor"
1355+
area = ar.AreaEntry(**area_kwargs)
13521356
registry.areas = ar.AreaRegistryItems()
1353-
registry.areas[area_in_floor.id] = area_in_floor
1357+
registry.areas[area.id] = area
13541358
hass.data[ar.DATA_REGISTRY] = registry
13551359
return registry
13561360

0 commit comments

Comments
 (0)