bec_widgets.tests.utils ======================= .. py:module:: bec_widgets.tests.utils Attributes ---------- .. autoapisummary:: bec_widgets.tests.utils.DEVICES Classes ------- .. autoapisummary:: bec_widgets.tests.utils.DMMock bec_widgets.tests.utils.Device bec_widgets.tests.utils.FakeDevice bec_widgets.tests.utils.FakePositioner bec_widgets.tests.utils.Positioner Functions --------- .. autoapisummary:: bec_widgets.tests.utils.check_remote_data_size Module Contents --------------- .. py:class:: DMMock(*args, **kwargs) .. py:method:: _get_redis_device_config() -> list[dict] Mock method to emulate DeviceManager._get_redis_device_config. .. py:method:: add_devices(devices: list) Add devices to the DeviceContainer. :param devices: List of device instances to add. :type devices: list .. py:method:: get_bec_signals(signal_class_name: str) Emulate DeviceManager.get_bec_signals for unit-tests. For “AsyncSignal” we list every device whose readout_priority is ReadoutPriority.ASYNC and build a minimal tuple (device_name, signal_name, signal_info_dict) that matches the real API shape used by Waveform._check_async_signal_found. .. py:method:: initialize() .. py:method:: shutdown() .. py:attribute:: config_helper .. py:attribute:: devices .. py:attribute:: enabled_devices .. py:class:: Device(name, enabled=True) Bases: :py:obj:`FakeDevice` just placeholder for testing embedded isinstance check in DeviceCombobox :param name: The name of the device. :type name: str :param info: The device info dictionary. Defaults to None. :type info: dict, optional :param parent: The parent object. Defaults to None. :type parent: [type], optional :param signal_info: The signal info dictionary. Defaults to None. :type signal_info: dict, optional :param class_name: The class name of the device. Defaults to None. If None, the class name is inferred from the class of the object. :type class_name: str, optional .. py:class:: FakeDevice(name, enabled=True, readout_priority=ReadoutPriority.MONITORED) Bases: :py:obj:`bec_lib.device.Device` Fake minimal positioner class for testing. :param name: The name of the device. :type name: str :param info: The device info dictionary. Defaults to None. :type info: dict, optional :param parent: The parent object. Defaults to None. :type parent: [type], optional :param signal_info: The signal info dictionary. Defaults to None. :type signal_info: dict, optional :param class_name: The class name of the device. Defaults to None. If None, the class name is inferred from the class of the object. :type class_name: str, optional .. py:method:: __contains__(item) .. py:method:: describe() -> dict Get the description of the device :returns: Description of the device :rtype: dict .. py:method:: set_value(fake_value: float = 1.0) -> None Setup fake value for device readout :param fake_value: Desired fake value :type fake_value: float .. py:property:: _hints .. py:attribute:: description .. py:property:: limits :type: tuple[float, float] .. py:property:: readout_priority get the readout priority for this device .. py:attribute:: signals .. py:class:: FakePositioner(name, enabled=True, limits=None, read_value=1.0, readout_priority=ReadoutPriority.MONITORED) Bases: :py:obj:`bec_lib.device.Positioner` Positioner: * trigger * read * set * stop * settle_time * timeout * egu * limits * low_limit * high_limit * move * position * moving :param name: The name of the device. :type name: str :param info: The device info dictionary. Defaults to None. :type info: dict, optional :param parent: The parent object. Defaults to None. :type parent: [type], optional :param signal_info: The signal info dictionary. Defaults to None. :type signal_info: dict, optional :param class_name: The class name of the device. Defaults to None. If None, the class name is inferred from the class of the object. :type class_name: str, optional .. py:method:: __contains__(item) .. py:method:: describe() -> dict Get the description of the device :returns: Description of the device :rtype: dict .. py:method:: move(value, relative=False) Simulates moving the device to a new position. .. py:method:: read(cached=False) Reads the device. :param cached: If True, the cached value is returned. Defaults to False. :type cached: bool, optional :param use_readback: If True, the readback value is returned, otherwise the read value. Defaults to True. :type use_readback: bool, optional :param filter_to_hints: If True, the readback value is filtered to the hinted values. Defaults to False. :type filter_to_hints: bool, optional :returns: The device signals. :rtype: dict .. py:method:: set_limits(limits) .. py:method:: set_read_value(value) .. py:method:: set_value(fake_value: float = 1.0) -> None Setup fake value for device readout :param fake_value: Desired fake value :type fake_value: float .. py:property:: _hints .. py:attribute:: description .. py:property:: enabled :type: bool Returns True if the device is enabled, otherwise False. .. py:property:: limits :type: tuple[float, float] Returns the device limits. .. py:attribute:: motor_is_moving_value :value: 0 .. py:property:: precision .. py:attribute:: read_value :value: 1.0 .. py:property:: readback .. py:property:: readout_priority get the readout priority for this device .. py:attribute:: setpoint_value :value: 1.0 .. py:attribute:: signals .. py:class:: Positioner(name='test', limits=None, read_value=1.0, enabled=True) Bases: :py:obj:`FakePositioner` just placeholder for testing embedded isinstance check in DeviceCombobox :param name: The name of the device. :type name: str :param info: The device info dictionary. Defaults to None. :type info: dict, optional :param parent: The parent object. Defaults to None. :type parent: [type], optional :param signal_info: The signal info dictionary. Defaults to None. :type signal_info: dict, optional :param class_name: The class name of the device. Defaults to None. If None, the class name is inferred from the class of the object. :type class_name: str, optional .. py:function:: check_remote_data_size(widget, plot_name, num_elements) Check if the remote data has the correct number of elements. Used in the qtbot.waitUntil function. .. py:data:: DEVICES