simplifies, documents and tests parse_serialized_key helper function

This commit is contained in:
Mose Müller
2024-04-26 08:15:21 +02:00
parent a2c60a9c40
commit 87d172b94b
2 changed files with 50 additions and 11 deletions

View File

@ -8,9 +8,24 @@ from pydase.utils.helpers import (
get_path_from_path_parts,
is_property_attribute,
parse_full_access_path,
parse_serialized_key,
)
@pytest.mark.parametrize(
"serialized_key, expected",
[
("attr_name", "attr_name"),
("[0]", 0),
("[0.0]", 0.0),
('["some_key"]', "some_key"),
('["12.34"]', "12.34"),
],
)
def test_parse_serialized_key(serialized_key: str, expected: str) -> None:
assert parse_serialized_key(serialized_key) == expected
@pytest.mark.parametrize(
"full_access_path, expected",
[