refactor(status): cleanup, remove error in test using 'and' instead of &

This commit is contained in:
2025-11-30 22:23:45 +01:00
committed by Christian Appel
parent 56fc45b58a
commit 6b758eb894
2 changed files with 12 additions and 7 deletions

View File

@@ -75,12 +75,17 @@ class AndStatus(StatusBase):
If any of the two Status objects fails, the combined status will fail If any of the two Status objects fails, the combined status will fail
with the exception of the first Status to fail. with the exception of the first Status to fail.
Parameters Args:
---------- left (StatusBase): Left status object.
left: StatusBase right (StatusBase): Right status object.
The left-hand Status object
right: StatusBase Examples:
The right-hand Status object >>> status1 = StatusBase(device1)
>>> status2 = StatusBase(device2)
>>> status3 = StatusBase(device3)
>>> combined_status = AndStatus(status1, status2)
>>> combined_status = status1 & status2
>>> combined_status = status1 & status2 & status3
""" """
def __init__(self, left, right, **kwargs): def __init__(self, left, right, **kwargs):

View File

@@ -970,7 +970,7 @@ def test_patched_status_objects():
dev_status = DeviceStatus(device=dev) dev_status = DeviceStatus(device=dev)
st = Status() st = Status()
and_st = st and dev_status and_st = st & dev_status
assert dev_status.device == dev assert dev_status.device == dev
dev_status.set_exception(RuntimeError("device error")) dev_status.set_exception(RuntimeError("device error"))
with pytest.raises(RuntimeError): with pytest.raises(RuntimeError):