From 0300ef2040c680efcb47afb8e1b9a23602712d7c Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <paulus@home-assistant.io> Date: Wed, 23 Jan 2019 16:33:21 -0800 Subject: [PATCH] Fix entity registry comments (#20357) --- homeassistant/helpers/entity_registry.py | 4 ++-- tests/helpers/test_entity_registry.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/homeassistant/helpers/entity_registry.py b/homeassistant/helpers/entity_registry.py index 82530708838..e4f266854ef 100644 --- a/homeassistant/helpers/entity_registry.py +++ b/homeassistant/helpers/entity_registry.py @@ -127,8 +127,8 @@ class EntityRegistry: device_id=device_id, # When we changed our slugify algorithm, we invalidated some # stored entity IDs with either a __ or ending in _. - # Fix introduced in 0.86 (Jan 23, 2018). Next line can be - # removed when we release 1.0 or in 2019. + # Fix introduced in 0.86 (Jan 23, 2019). Next line can be + # removed when we release 1.0 or in 2020. new_entity_id='.'.join(slugify(part) for part in entity_id.split('.', 1))) diff --git a/tests/helpers/test_entity_registry.py b/tests/helpers/test_entity_registry.py index ef7b4a60ee2..b1c13a36c6d 100644 --- a/tests/helpers/test_entity_registry.py +++ b/tests/helpers/test_entity_registry.py @@ -240,6 +240,10 @@ async def test_loading_invalid_entity_id(hass, hass_storage): 'entity_id': 'test.invalid_end_', 'platform': 'super_platform', 'unique_id': 'id-invalid-end', + }, { + 'entity_id': 'test._invalid_start', + 'platform': 'super_platform', + 'unique_id': 'id-invalid-start', } ] } @@ -256,3 +260,8 @@ async def test_loading_invalid_entity_id(hass, hass_storage): 'test', 'super_platform', 'id-invalid-end') assert valid_entity_id(entity_invalid_end.entity_id) + + entity_invalid_start = registry.async_get_or_create( + 'test', 'super_platform', 'id-invalid-start') + + assert valid_entity_id(entity_invalid_start.entity_id) -- GitLab