mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-03 20:30:40 +02:00
adds tests for parse_keyed_attribute
This commit is contained in:
parent
32e2a8a4d1
commit
6cae76bde1
@ -1,7 +1,9 @@
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from pydase.utils.helpers import (
|
||||
is_property_attribute,
|
||||
parse_keyed_attribute,
|
||||
)
|
||||
|
||||
|
||||
@ -29,3 +31,18 @@ def test_is_property_attribute(attr_name: str, expected: bool) -> None:
|
||||
|
||||
dummy = DummyClass()
|
||||
assert is_property_attribute(dummy, attr_name) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"attr_name, expected",
|
||||
[
|
||||
("attr_name", ("attr_name", None)),
|
||||
("list_attr[2]", ("list_attr", 2)),
|
||||
('dict_attr["2"]', ("dict_attr", "2")),
|
||||
('dict_attr["some_key"]', ("dict_attr", "some_key")),
|
||||
("dict_attr[2]", ("dict_attr", 2)),
|
||||
("dict_attr[2.1]", ("dict_attr", 2.1)),
|
||||
],
|
||||
)
|
||||
def test_parse_keyed_attributes(attr_name: str, expected: tuple[str, Any]) -> None:
|
||||
assert parse_keyed_attribute(attr_name) == expected
|
||||
|
Loading…
x
Reference in New Issue
Block a user