mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 16:50:02 +02:00
26 lines
722 B
Python
26 lines
722 B
Python
import logging
|
|
|
|
import pydase
|
|
from pydase.data_service.data_service_cache import DataServiceCache
|
|
from pydase.utils.serializer import get_nested_dict_by_path
|
|
|
|
logger = logging.getLogger()
|
|
|
|
|
|
def test_nested_attributes_cache_callback() -> None:
|
|
class SubClass(pydase.DataService):
|
|
name = "Hello"
|
|
|
|
class ServiceClass(pydase.DataService):
|
|
class_attr = SubClass()
|
|
name = "World"
|
|
|
|
test_service = ServiceClass()
|
|
cache = DataServiceCache(test_service)
|
|
|
|
test_service.name = "Peepz"
|
|
assert get_nested_dict_by_path(cache.cache, "name")["value"] == "Peepz"
|
|
|
|
test_service.class_attr.name = "Ciao"
|
|
assert get_nested_dict_by_path(cache.cache, "class_attr.name")["value"] == "Ciao"
|