mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-11 07:47:12 +02:00
updates tests
This commit is contained in:
@ -51,7 +51,7 @@ def test_convert_to_quantity() -> None:
|
||||
assert u.convert_to_quantity(1.0 * u.units.mV) == 1.0 * u.units.mV
|
||||
|
||||
|
||||
def test_update_DataService_attribute(caplog: LogCaptureFixture) -> None:
|
||||
def test_set_service_attribute_value_by_path(caplog: LogCaptureFixture) -> None:
|
||||
class ServiceClass(DataService):
|
||||
voltage = 1.0 * u.units.V
|
||||
_current: u.Quantity = 1.0 * u.units.mA
|
||||
@ -68,20 +68,20 @@ def test_update_DataService_attribute(caplog: LogCaptureFixture) -> None:
|
||||
state_manager = StateManager(service_instance)
|
||||
DataServiceObserver(state_manager)
|
||||
|
||||
service_instance.update_DataService_attribute(
|
||||
path_list=[], attr_name="voltage", value=1.0 * u.units.mV
|
||||
state_manager.set_service_attribute_value_by_path(
|
||||
path="voltage", value=1.0 * u.units.mV
|
||||
)
|
||||
|
||||
assert "'voltage' changed to '1.0 mV'" in caplog.text
|
||||
caplog.clear()
|
||||
|
||||
service_instance.update_DataService_attribute(path_list=[], attr_name="voltage", value=2)
|
||||
state_manager.set_service_attribute_value_by_path(path="voltage", value=2)
|
||||
|
||||
assert "'voltage' changed to '2.0 mV'" in caplog.text
|
||||
caplog.clear()
|
||||
|
||||
service_instance.update_DataService_attribute(
|
||||
path_list=[], attr_name="voltage", value={"magnitude": 123, "unit": "kV"}
|
||||
state_manager.set_service_attribute_value_by_path(
|
||||
path="voltage", value={"magnitude": 123, "unit": "kV"}
|
||||
)
|
||||
|
||||
assert "'voltage' changed to '123.0 kV'" in caplog.text
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user