ophyd_async.core.set_mock_values#

ophyd_async.core.set_mock_values(signal: Signal, values: Iterable[Any], require_all_consumed: bool = False) _SetValuesIterator[source]#

Iterator to set a signal to a sequence of values, optionally repeating the sequence.

Parameters:
  • signal – A signal with a MockSignalBackend backend.

  • values – An iterable of the values to set the signal to, on each iteration the value will be set.

  • require_all_consumed – If True, an AssertionError will be raised if the iterator is deleted before all values have been consumed.

Notes

Example usage:

for value_set in set_mock_values(signal, [1, 2, 3]):
     # do something

 cm = set_mock_values(signal, 1, 2, 3, require_all_consumed=True):
 next(cm)
 # do something