mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 01:08:03 +01:00
Fix replaced - in allowed characters during object_id sanitizing (#5983)
This commit is contained in:
parent
cfa5e5c5a9
commit
2ee01e22cd
2 changed files with 2 additions and 1 deletions
|
@ -357,7 +357,7 @@ def snake_case(value):
|
||||||
return value.replace(" ", "_").lower()
|
return value.replace(" ", "_").lower()
|
||||||
|
|
||||||
|
|
||||||
_DISALLOWED_CHARS = re.compile(r"[^a-zA-Z0-9_]")
|
_DISALLOWED_CHARS = re.compile(r"[^a-zA-Z0-9-_]")
|
||||||
|
|
||||||
|
|
||||||
def sanitize(value):
|
def sanitize(value):
|
||||||
|
|
|
@ -261,6 +261,7 @@ def test_snake_case(text, expected):
|
||||||
('!"§$%&/()=?foo_bar', "___________foo_bar"),
|
('!"§$%&/()=?foo_bar', "___________foo_bar"),
|
||||||
('foo_!"§$%&/()=?bar', "foo____________bar"),
|
('foo_!"§$%&/()=?bar', "foo____________bar"),
|
||||||
('foo_bar!"§$%&/()=?', "foo_bar___________"),
|
('foo_bar!"§$%&/()=?', "foo_bar___________"),
|
||||||
|
('foo-bar!"§$%&/()=?', "foo-bar___________"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
def test_sanitize(text, expected):
|
def test_sanitize(text, expected):
|
||||||
|
|
Loading…
Reference in a new issue