mirror of
https://github.com/esphome/esphome.git
synced 2025-09-02 03:12:20 +01:00
EntityBase: Move ObjectId to Flash (#4569)
* Move EntityBase Object Id from memory to flash. * Sprinkler use common `setup_entity` method. * Remove `EntityBase` from Sprinkler. * Support for entity names set to None * change so gh PR picks up commit. --------- Co-authored-by: Your Name <you@example.com> Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
@@ -229,3 +229,37 @@ def test_file_compare(fixture_path, file1, file2, expected):
|
||||
actual = helpers.file_compare(path1, path2)
|
||||
|
||||
assert actual == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"text, expected",
|
||||
(
|
||||
("foo", "foo"),
|
||||
("foo bar", "foo_bar"),
|
||||
("foo Bar", "foo_bar"),
|
||||
("foo BAR", "foo_bar"),
|
||||
("foo.bar", "foo.bar"),
|
||||
("fooBAR", "foobar"),
|
||||
("Foo-bar_EEK", "foo-bar_eek"),
|
||||
(" foo", "__foo"),
|
||||
),
|
||||
)
|
||||
def test_snake_case(text, expected):
|
||||
actual = helpers.snake_case(text)
|
||||
|
||||
assert actual == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"text, expected",
|
||||
(
|
||||
("foo_bar", "foo_bar"),
|
||||
('!"§$%&/()=?foo_bar', "foo_bar"),
|
||||
('foo_!"§$%&/()=?bar', "foo_bar"),
|
||||
('foo_bar!"§$%&/()=?', "foo_bar"),
|
||||
),
|
||||
)
|
||||
def test_sanitize(text, expected):
|
||||
actual = helpers.sanitize(text)
|
||||
|
||||
assert actual == expected
|
||||
|
Reference in New Issue
Block a user