mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-05 13:10:41 +02:00
updates tests
This commit is contained in:
parent
ba9dbc03f1
commit
9c3c92361b
@ -138,7 +138,6 @@ def test_removed_observer_on_class_dict_attr(caplog: pytest.LogCaptureFixture) -
|
|||||||
caplog.clear()
|
caplog.clear()
|
||||||
|
|
||||||
assert nested_instance._observers == {
|
assert nested_instance._observers == {
|
||||||
'["nested"]': [],
|
|
||||||
"nested_attr": [instance],
|
"nested_attr": [instance],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +171,6 @@ def test_removed_observer_on_instance_dict_attr(
|
|||||||
caplog.clear()
|
caplog.clear()
|
||||||
|
|
||||||
assert nested_instance._observers == {
|
assert nested_instance._observers == {
|
||||||
'["nested"]': [],
|
|
||||||
"nested_attr": [instance],
|
"nested_attr": [instance],
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +209,6 @@ def test_pop(caplog: pytest.LogCaptureFixture) -> None:
|
|||||||
instance = MyObservable()
|
instance = MyObservable()
|
||||||
MyObserver(instance)
|
MyObserver(instance)
|
||||||
assert instance.dict_attr.pop("nested") == nested_instance
|
assert instance.dict_attr.pop("nested") == nested_instance
|
||||||
assert nested_instance._observers == {'["nested"]': []}
|
assert nested_instance._observers == {}
|
||||||
|
|
||||||
assert f"'dict_attr' changed to '{instance.dict_attr}'" in caplog.text
|
assert f"'dict_attr' changed to '{instance.dict_attr}'" in caplog.text
|
||||||
|
@ -81,11 +81,21 @@ def test_removed_observer_on_class_list_attr(caplog: pytest.LogCaptureFixture) -
|
|||||||
|
|
||||||
instance = MyObservable()
|
instance = MyObservable()
|
||||||
MyObserver(instance)
|
MyObserver(instance)
|
||||||
|
|
||||||
|
assert nested_instance._observers == {
|
||||||
|
"[0]": [instance.changed_list_attr],
|
||||||
|
"nested_attr": [instance],
|
||||||
|
}
|
||||||
|
|
||||||
instance.changed_list_attr[0] = "Ciao"
|
instance.changed_list_attr[0] = "Ciao"
|
||||||
|
|
||||||
assert "'changed_list_attr[0]' changed to 'Ciao'" in caplog.text
|
assert "'changed_list_attr[0]' changed to 'Ciao'" in caplog.text
|
||||||
caplog.clear()
|
caplog.clear()
|
||||||
|
|
||||||
|
assert nested_instance._observers == {
|
||||||
|
"nested_attr": [instance],
|
||||||
|
}
|
||||||
|
|
||||||
instance.nested_attr.name = "Hi"
|
instance.nested_attr.name = "Hi"
|
||||||
|
|
||||||
assert "'nested_attr.name' changed to 'Hi'" in caplog.text
|
assert "'nested_attr.name' changed to 'Hi'" in caplog.text
|
||||||
@ -115,6 +125,10 @@ def test_removed_observer_on_instance_list_attr(
|
|||||||
assert "'changed_list_attr[0]' changed to 'Ciao'" in caplog.text
|
assert "'changed_list_attr[0]' changed to 'Ciao'" in caplog.text
|
||||||
caplog.clear()
|
caplog.clear()
|
||||||
|
|
||||||
|
assert nested_instance._observers == {
|
||||||
|
"nested_attr": [instance],
|
||||||
|
}
|
||||||
|
|
||||||
instance.nested_attr.name = "Hi"
|
instance.nested_attr.name = "Hi"
|
||||||
|
|
||||||
assert "'nested_attr.name' changed to 'Hi'" in caplog.text
|
assert "'nested_attr.name' changed to 'Hi'" in caplog.text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user