mirror of
https://github.com/bec-project/ophyd_devices.git
synced 2026-02-07 07:38:40 +01:00
refactor(status): cleanup, remove error in test using 'and' instead of &
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user