Skip to content

Commit a3eade9

Browse files
committed
Fix tests for entity naming
1 parent aa99cdb commit a3eade9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/test_registries.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -559,19 +559,18 @@ def test_entity_names() -> None:
559559

560560
for _, entity_classes in iter_all_rules():
561561
for entity_class in entity_classes:
562-
if hasattr(entity_class, "_attr_fallback_name"):
563-
# The entity has a name
562+
if entity_class._attr_fallback_name is not None:
564563
assert (
565564
isinstance(entity_class._attr_fallback_name, str)
566565
and entity_class._attr_fallback_name
567566
)
568-
elif hasattr(entity_class, "_attr_translation_key"):
567+
elif entity_class._attr_translation_key is not None:
569568
assert (
570569
isinstance(entity_class._attr_translation_key, str)
571570
and entity_class._attr_translation_key
572571
)
573-
elif hasattr(entity_class, "_attr_device_class"):
574-
assert entity_class._attr_device_class
572+
elif entity_class._attr_device_class is not None:
573+
pass
575574
else:
576575
# The only exception (for now) is IASZone
577576
assert entity_class is IASZone

0 commit comments

Comments
 (0)