mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-11 07:47:12 +02:00
adds support for datetime serialization
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import enum
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
import pydase.components
|
||||
@ -137,6 +138,16 @@ def test_loads_primitive_types(obj: Any, obj_serialization: SerializedObject) ->
|
||||
"name": "MyService",
|
||||
},
|
||||
),
|
||||
(
|
||||
datetime.fromisoformat("2024-07-09 15:37:08.249845"),
|
||||
{
|
||||
"full_access_path": "",
|
||||
"type": "datetime",
|
||||
"value": "2024-07-09 15:37:08.249845",
|
||||
"readonly": True,
|
||||
"doc": None,
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_loads_advanced_types(obj: Any, obj_serialization: SerializedObject) -> None:
|
||||
|
@ -1,5 +1,6 @@
|
||||
import asyncio
|
||||
import enum
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Any, ClassVar
|
||||
|
||||
@ -92,6 +93,16 @@ service_instance = ServiceClass()
|
||||
"doc": None,
|
||||
},
|
||||
),
|
||||
(
|
||||
datetime.fromisoformat("2024-07-09 15:37:08.249845"),
|
||||
{
|
||||
"full_access_path": "",
|
||||
"type": "datetime",
|
||||
"value": "2024-07-09 15:37:08.249845",
|
||||
"readonly": True,
|
||||
"doc": None,
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_dump(test_input: Any, expected: dict[str, Any]) -> None:
|
||||
@ -476,8 +487,7 @@ def test_derived_data_service_serialization() -> None:
|
||||
def name(self, value: str) -> None:
|
||||
self._name = value
|
||||
|
||||
class DerivedService(BaseService):
|
||||
...
|
||||
class DerivedService(BaseService): ...
|
||||
|
||||
base_service_serialization = dump(BaseService())
|
||||
derived_service_serialization = dump(DerivedService())
|
||||
|
Reference in New Issue
Block a user