mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-20 00:10:03 +02:00
removes tests for get_object_attr_from_path (uses get_object_by_path_parts internally)
This commit is contained in:
parent
b314ae7dec
commit
348f8aac9b
@ -126,7 +126,7 @@ def get_object_by_path_parts(target_obj: Any, path_parts: list[str]) -> Any:
|
|||||||
try:
|
try:
|
||||||
target_obj = getattr(target_obj, part)
|
target_obj = getattr(target_obj, part)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
logger.debug("Attribute % does not exist in the object.", part)
|
logger.debug("Attribute %a does not exist in the object.", part)
|
||||||
return None
|
return None
|
||||||
return target_obj
|
return target_obj
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ from typing import Any
|
|||||||
import pydase
|
import pydase
|
||||||
import pytest
|
import pytest
|
||||||
from pydase.utils.helpers import (
|
from pydase.utils.helpers import (
|
||||||
get_object_attr_from_path,
|
|
||||||
get_object_by_path_parts,
|
get_object_by_path_parts,
|
||||||
get_path_from_path_parts,
|
get_path_from_path_parts,
|
||||||
is_property_attribute,
|
is_property_attribute,
|
||||||
@ -144,18 +143,3 @@ def test_is_property_attribute(attr_name: str, expected: bool) -> None:
|
|||||||
|
|
||||||
dummy = DummyClass()
|
dummy = DummyClass()
|
||||||
assert is_property_attribute(dummy, attr_name) == expected
|
assert is_property_attribute(dummy, attr_name) == expected
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"path, expected",
|
|
||||||
[
|
|
||||||
("some_float", service_instance.some_float),
|
|
||||||
("subservice", service_instance.subservice),
|
|
||||||
("list_attr[0]", service_instance.list_attr[0]),
|
|
||||||
("list_attr[1]", service_instance.list_attr[1]),
|
|
||||||
("dict_attr['foo']", service_instance.dict_attr["foo"]),
|
|
||||||
("dict_attr[2.1]", service_instance.dict_attr[2.1]),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_get_object_attr_from_path(path: str, expected: Any) -> None:
|
|
||||||
assert get_object_attr_from_path(service_instance, path) == expected
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user