fix: removes notification for updating protected lists

This commit is contained in:
Mose Müller
2023-10-12 14:12:48 +02:00
parent 48e8b7dbaf
commit b04ad0c6a3
2 changed files with 36 additions and 4 deletions

View File

@ -99,3 +99,29 @@ def test_nested_reused_instance_list_attribute(capsys: CaptureFixture) -> None:
)
actual_output = sorted(captured.out.strip().split("\n"))
assert actual_output == expected_output
def test_protected_list_attribute(capsys: CaptureFixture) -> None:
"""Changing protected lists should not emit notifications for the lists themselves, but
still for all properties depending on them.
"""
class ServiceClass(DataService):
_attr = [0, 1]
@property
def list_dependend_property(self) -> int:
return self._attr[0]
service_instance = ServiceClass()
service_instance._attr[0] = 1337
captured = capsys.readouterr()
expected_output = sorted(
[
"ServiceClass.list_dependend_property = 1337",
]
)
actual_output = sorted(captured.out.strip().split("\n")) # type: ignore
assert actual_output == expected_output