removes tests for get_object_attr_from_path (uses get_object_by_path_parts internally)

This commit is contained in:
Mose Müller 2024-04-26 09:49:01 +02:00
parent b314ae7dec
commit 348f8aac9b
2 changed files with 1 additions and 17 deletions

View File

@ -126,7 +126,7 @@ def get_object_by_path_parts(target_obj: Any, path_parts: list[str]) -> Any:
try:
target_obj = getattr(target_obj, part)
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 target_obj

View File

@ -3,7 +3,6 @@ from typing import Any
import pydase
import pytest
from pydase.utils.helpers import (
get_object_attr_from_path,
get_object_by_path_parts,
get_path_from_path_parts,
is_property_attribute,
@ -144,18 +143,3 @@ def test_is_property_attribute(attr_name: str, expected: bool) -> None:
dummy = DummyClass()
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