mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 08:40:03 +02:00
Merge pull request #71 from tiqi-group/fix/update_task_status
Fix: update task status
This commit is contained in:
commit
0cd3a7e8a8
@ -311,8 +311,11 @@ class Server:
|
||||
get_nested_dict_by_path(self._state_manager.cache, full_access_path)
|
||||
)
|
||||
serialized_value = dump(value)
|
||||
|
||||
if cached_value_dict["type"] != "method":
|
||||
cached_value_dict["type"] = serialized_value["type"]
|
||||
|
||||
cached_value_dict["value"] = serialized_value["value"]
|
||||
cached_value_dict["type"] = serialized_value["type"]
|
||||
|
||||
async def notify() -> None:
|
||||
try:
|
||||
|
@ -259,8 +259,9 @@ def set_nested_value_by_path(
|
||||
# setting the new value
|
||||
serialized_value = dump(value)
|
||||
if "readonly" in current_dict:
|
||||
if current_dict["type"] != "method":
|
||||
current_dict["type"] = serialized_value["type"]
|
||||
current_dict["value"] = serialized_value["value"]
|
||||
current_dict["type"] = serialized_value["type"]
|
||||
else:
|
||||
current_dict.update(serialized_value)
|
||||
|
||||
|
@ -23,3 +23,20 @@ def test_nested_attributes_cache_callback() -> None:
|
||||
|
||||
test_service.class_attr.name = "Ciao"
|
||||
assert get_nested_dict_by_path(cache.cache, "class_attr.name")["value"] == "Ciao"
|
||||
|
||||
|
||||
def test_task_status_update() -> None:
|
||||
class ServiceClass(pydase.DataService):
|
||||
name = "World"
|
||||
|
||||
async def my_method(self) -> None:
|
||||
pass
|
||||
|
||||
test_service = ServiceClass()
|
||||
cache = DataServiceCache(test_service)
|
||||
assert get_nested_dict_by_path(cache.cache, "my_method")["type"] == "method"
|
||||
assert get_nested_dict_by_path(cache.cache, "my_method")["value"] is None
|
||||
|
||||
test_service.start_my_method() # type: ignore
|
||||
assert get_nested_dict_by_path(cache.cache, "my_method")["type"] == "method"
|
||||
assert get_nested_dict_by_path(cache.cache, "my_method")["value"] == {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user