bec-widgets 0.44.4__py3-none-any.whl → 0.45.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. bec_widgets/cli/client.py +105 -5
  2. bec_widgets/cli/client_utils.py +4 -4
  3. bec_widgets/cli/generate_cli.py +6 -4
  4. bec_widgets/cli/server.py +2 -3
  5. bec_widgets/examples/__init__.py +1 -1
  6. bec_widgets/examples/eiger_plot/eiger_plot.py +3 -11
  7. bec_widgets/examples/mca_readout/mca_plot.py +21 -24
  8. bec_widgets/examples/mca_readout/mca_sim.py +7 -12
  9. bec_widgets/examples/motor_movement/__init__.py +1 -1
  10. bec_widgets/examples/motor_movement/motor_control_compilations.py +3 -8
  11. bec_widgets/examples/motor_movement/motor_controller.ui +1 -1
  12. bec_widgets/examples/motor_movement/motor_example.py +13 -14
  13. bec_widgets/examples/stream_plot/stream_plot.py +5 -4
  14. bec_widgets/utils/__init__.py +5 -5
  15. bec_widgets/utils/bec_connector.py +1 -1
  16. bec_widgets/utils/bec_dispatcher.py +1 -2
  17. bec_widgets/utils/bec_table.py +1 -1
  18. bec_widgets/utils/crosshair.py +2 -1
  19. bec_widgets/utils/validator_delegate.py +1 -1
  20. bec_widgets/utils/widget_io.py +6 -6
  21. bec_widgets/utils/yaml_dialog.py +1 -0
  22. bec_widgets/validation/monitor_config_validator.py +6 -6
  23. bec_widgets/widgets/__init__.py +7 -8
  24. bec_widgets/widgets/editor/editor.py +6 -14
  25. bec_widgets/widgets/figure/__init__.py +1 -1
  26. bec_widgets/widgets/figure/figure.py +74 -4
  27. bec_widgets/widgets/monitor/__init__.py +0 -1
  28. bec_widgets/widgets/monitor/config_dialog.py +7 -8
  29. bec_widgets/widgets/monitor/monitor.py +16 -26
  30. bec_widgets/widgets/monitor_scatter_2D/monitor_scatter_2D.py +11 -19
  31. bec_widgets/widgets/motor_control/__init__.py +2 -2
  32. bec_widgets/widgets/motor_control/motor_control.py +11 -10
  33. bec_widgets/widgets/motor_map/motor_map.py +2 -3
  34. bec_widgets/widgets/plots/__init__.py +4 -3
  35. bec_widgets/widgets/plots/image.py +7 -6
  36. bec_widgets/widgets/plots/motor_map.py +423 -0
  37. bec_widgets/widgets/plots/plot_base.py +1 -2
  38. bec_widgets/widgets/plots/waveform1d.py +24 -23
  39. bec_widgets/widgets/scan_control/scan_control.py +12 -12
  40. bec_widgets/widgets/toolbar/toolbar.py +2 -4
  41. {bec_widgets-0.44.4.dist-info → bec_widgets-0.45.0.dist-info}/METADATA +2 -1
  42. bec_widgets-0.45.0.dist-info/RECORD +98 -0
  43. tests/client_mocks.py +76 -30
  44. tests/conftest.py +2 -1
  45. tests/test_bec_connector.py +2 -1
  46. tests/test_bec_dispatcher.py +3 -4
  47. tests/test_bec_figure.py +14 -2
  48. tests/test_bec_monitor.py +7 -76
  49. tests/test_bec_monitor_scatter2D.py +8 -32
  50. tests/test_bec_motor_map.py +125 -0
  51. tests/test_config_dialog.py +4 -66
  52. tests/test_editor.py +2 -4
  53. tests/test_eiger_plot.py +2 -0
  54. tests/test_generate_cli_client.py +4 -2
  55. tests/test_motor_control.py +25 -92
  56. tests/test_motor_map.py +10 -66
  57. tests/test_plot_base.py +1 -0
  58. tests/test_scan_control.py +1 -1
  59. tests/test_stream_plot.py +2 -2
  60. tests/test_validator_errors.py +5 -4
  61. tests/test_waveform1d.py +31 -12
  62. tests/test_widget_io.py +1 -8
  63. tests/test_yaml_dialog.py +2 -1
  64. bec_widgets-0.44.4.dist-info/RECORD +0 -96
  65. {bec_widgets-0.44.4.dist-info → bec_widgets-0.45.0.dist-info}/LICENSE +0 -0
  66. {bec_widgets-0.44.4.dist-info → bec_widgets-0.45.0.dist-info}/WHEEL +0 -0
  67. {bec_widgets-0.44.4.dist-info → bec_widgets-0.45.0.dist-info}/top_level.txt +0 -0
@@ -2,12 +2,13 @@
2
2
  import os
3
3
  from unittest.mock import MagicMock
4
4
 
5
+ import pytest
5
6
  import yaml
7
+ from qtpy.QtWidgets import QTableWidgetItem, QTabWidget
6
8
 
7
- import pytest
8
- from qtpy.QtWidgets import QTabWidget, QTableWidgetItem
9
+ from bec_widgets.widgets.monitor.config_dialog import ConfigDialog
9
10
 
10
- from bec_widgets.widgets import ConfigDialog
11
+ from .client_mocks import mocked_client
11
12
 
12
13
 
13
14
  def load_test_config(config_name):
@@ -18,69 +19,6 @@ def load_test_config(config_name):
18
19
  return config
19
20
 
20
21
 
21
- class FakeDevice:
22
- """Fake minimal positioner class for testing."""
23
-
24
- def __init__(self, name, enabled=True):
25
- self.name = name
26
- self.enabled = enabled
27
- self.signals = {self.name: {"value": 1.0}}
28
- self.description = {self.name: {"source": self.name}}
29
-
30
- def __contains__(self, item):
31
- return item == self.name
32
-
33
- @property
34
- def _hints(self):
35
- return [self.name]
36
-
37
- def set_value(self, fake_value: float = 1.0) -> None:
38
- """
39
- Setup fake value for device readout
40
- Args:
41
- fake_value(float): Desired fake value
42
- """
43
- self.signals[self.name]["value"] = fake_value
44
-
45
- def describe(self) -> dict:
46
- """
47
- Get the description of the device
48
- Returns:
49
- dict: Description of the device
50
- """
51
- return self.description
52
-
53
-
54
- def get_mocked_device(device_name: str):
55
- """
56
- Helper function to mock the devices
57
- Args:
58
- device_name(str): Name of the device to mock
59
- """
60
- return FakeDevice(name=device_name, enabled=True)
61
-
62
-
63
- @pytest.fixture(scope="function")
64
- def mocked_client():
65
- # Create a dictionary of mocked devices
66
- device_names = ["samx", "gauss_bpm", "gauss_adc1", "gauss_adc2", "gauss_adc3", "bpm4i"]
67
- mocked_devices = {name: get_mocked_device(name) for name in device_names}
68
-
69
- # Create a MagicMock object
70
- client = MagicMock()
71
-
72
- # Mock the device_manager.devices attribute
73
- client.device_manager.devices = MagicMock()
74
- client.device_manager.devices.__getitem__.side_effect = lambda x: mocked_devices.get(x)
75
- client.device_manager.devices.__contains__.side_effect = lambda x: x in mocked_devices
76
-
77
- # Set each device as an attribute of the mock
78
- for name, device in mocked_devices.items():
79
- setattr(client.device_manager.devices, name, device)
80
-
81
- return client
82
-
83
-
84
22
  @pytest.fixture(scope="function")
85
23
  def config_dialog(qtbot, mocked_client):
86
24
  client = mocked_client
tests/test_editor.py CHANGED
@@ -2,13 +2,11 @@
2
2
 
3
3
  import os
4
4
  import tempfile
5
- from unittest.mock import MagicMock
6
- from unittest.mock import patch, mock_open
5
+ from unittest.mock import MagicMock, mock_open, patch
7
6
 
8
7
  import pytest
9
-
10
- from qtpy.QtWidgets import QTextEdit
11
8
  from qtpy.Qsci import QsciScintilla
9
+ from qtpy.QtWidgets import QTextEdit
12
10
 
13
11
  from bec_widgets.widgets.editor.editor import AutoCompleter, BECEditor
14
12
 
tests/test_eiger_plot.py CHANGED
@@ -1,10 +1,12 @@
1
1
  # pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
2
2
  import json
3
3
  from unittest.mock import MagicMock, patch
4
+
4
5
  import numpy as np
5
6
  import pyqtgraph as pg
6
7
  import pytest
7
8
  import zmq
9
+
8
10
  from bec_widgets.examples.eiger_plot.eiger_plot import EigerPlot
9
11
 
10
12
 
@@ -1,7 +1,9 @@
1
- import pytest
2
- from bec_widgets.cli.generate_cli import ClientGenerator
3
1
  from textwrap import dedent
2
+
4
3
  import black
4
+ import pytest
5
+
6
+ from bec_widgets.cli.generate_cli import ClientGenerator
5
7
 
6
8
 
7
9
  # Mock classes to test the generator
@@ -1,16 +1,9 @@
1
1
  # pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
2
- from unittest.mock import patch
3
- from bec_lib.device import Positioner
2
+ from unittest.mock import MagicMock, patch
3
+
4
4
  import pytest
5
- from unittest.mock import MagicMock
5
+ from bec_lib.devicemanager import DeviceContainer
6
6
 
7
- from bec_widgets.widgets import (
8
- MotorControlSelection,
9
- MotorControlAbsolute,
10
- MotorControlRelative,
11
- MotorThread,
12
- MotorCoordinateTable,
13
- )
14
7
  from bec_widgets.examples import (
15
8
  MotorControlApp,
16
9
  MotorControlMap,
@@ -18,8 +11,16 @@ from bec_widgets.examples import (
18
11
  MotorControlPanelAbsolute,
19
12
  MotorControlPanelRelative,
20
13
  )
14
+ from bec_widgets.widgets import (
15
+ MotorControlAbsolute,
16
+ MotorControlRelative,
17
+ MotorControlSelection,
18
+ MotorCoordinateTable,
19
+ MotorThread,
20
+ )
21
21
  from bec_widgets.widgets.motor_control.motor_control import MotorActions
22
22
 
23
+ from .client_mocks import mocked_client
23
24
 
24
25
  CONFIG_DEFAULT = {
25
26
  "motor_control": {
@@ -53,81 +54,6 @@ CONFIG_DEFAULT = {
53
54
  ],
54
55
  }
55
56
 
56
- #######################################################
57
- # Client and devices fixture
58
- #######################################################
59
-
60
-
61
- class FakeDevice:
62
- """Fake minimal positioner class for testing."""
63
-
64
- def __init__(self, name, enabled=True, limits=None, read_value=1.0):
65
- super().__init__()
66
- self.name = name
67
- self.enabled = enabled
68
- self.read_value = read_value
69
- self.limits = limits or (-100, 100) # Default limits if not provided
70
-
71
- def read(self):
72
- """Simulates reading the current position of the device."""
73
- return {self.name: {"value": self.read_value}}
74
-
75
- def move(self, value, relative=False):
76
- """Simulates moving the device to a new position."""
77
- if relative:
78
- self.read_value += value
79
- else:
80
- self.read_value = value
81
- # Respect the limits
82
- self.read_value = max(min(self.read_value, self.limits[1]), self.limits[0])
83
-
84
- @property
85
- def readback(self):
86
- return MagicMock(get=MagicMock(return_value=self.read_value))
87
-
88
- def describe(self):
89
- """Describes the device."""
90
- return {self.name: {"source": self.name, "dtype": "number", "shape": []}}
91
-
92
-
93
- @pytest.fixture
94
- def mocked_client():
95
- client = MagicMock()
96
-
97
- # Setup the fake devices
98
- motors = {
99
- "samx": FakeDevice("samx", limits=[-10, 10], read_value=2.0),
100
- "samy": FakeDevice("samy", limits=[-5, 5], read_value=3.0),
101
- "aptrx": FakeDevice("aptrx", read_value=4.0),
102
- "aptry": FakeDevice("aptry", read_value=5.0),
103
- }
104
-
105
- client.device_manager.devices = MagicMock()
106
- client.device_manager.devices.__getitem__.side_effect = lambda x: motors.get(x, FakeDevice(x))
107
- client.device_manager.devices.enabled_devices = list(motors.values())
108
-
109
- # Mock the scans.mv method
110
- def mock_mv(*args, relative=False):
111
- # Extracting motor and value pairs
112
- for i in range(0, len(args), 2):
113
- motor = args[i]
114
- value = args[i + 1]
115
- motor.move(value, relative=relative)
116
- return MagicMock(wait=MagicMock()) # Simulate wait method of the move status object
117
-
118
- client.scans = MagicMock(mv=mock_mv)
119
-
120
- # Ensure isinstance check for Positioner passes
121
- original_isinstance = isinstance
122
-
123
- def isinstance_mock(obj, class_info):
124
- if class_info == Positioner:
125
- return True
126
- return original_isinstance(obj, class_info)
127
-
128
- with patch("builtins.isinstance", new=isinstance_mock):
129
- yield client
130
-
131
57
 
132
58
  #######################################################
133
59
  # Motor Thread
@@ -141,7 +67,7 @@ def motor_thread(mocked_client):
141
67
  def test_motor_thread_initialization(mocked_client):
142
68
  motor_thread = MotorThread(client=mocked_client)
143
69
  assert motor_thread.client == mocked_client
144
- assert isinstance(motor_thread.dev, MagicMock)
70
+ assert isinstance(motor_thread.dev, DeviceContainer)
145
71
 
146
72
 
147
73
  def test_get_all_motors_names(mocked_client):
@@ -176,12 +102,16 @@ def test_move_motor_absolute_by_run(mocked_client):
176
102
 
177
103
  def test_move_motor_relative_by_run(mocked_client):
178
104
  motor_thread = MotorThread(client=mocked_client)
105
+
106
+ initial_value = motor_thread.dev["samx"].read()["samx"]["value"]
107
+ move_value = 2.0
108
+ expected_value = initial_value + move_value
179
109
  motor_thread.motor = "samx"
180
- motor_thread.value = 2.0
110
+ motor_thread.value = move_value
181
111
  motor_thread.action = MotorActions.MOVE_RELATIVE
182
112
  motor_thread.run()
183
113
 
184
- assert mocked_client.device_manager.devices["samx"].read_value == 4.0
114
+ assert mocked_client.device_manager.devices["samx"].read_value == expected_value
185
115
 
186
116
 
187
117
  def test_motor_thread_move_absolute(motor_thread):
@@ -292,8 +222,12 @@ def test_absolute_initialization(motor_absolute_widget):
292
222
 
293
223
 
294
224
  def test_absolute_save_current_coordinates(motor_absolute_widget):
295
- motor_absolute_widget.client.device_manager["samx"].set_value(2.0)
296
- motor_absolute_widget.client.device_manager["samy"].set_value(3.0)
225
+ motor_x_value = motor_absolute_widget.client.device_manager.devices["samx"].read()["samx"][
226
+ "value"
227
+ ]
228
+ motor_y_value = motor_absolute_widget.client.device_manager.devices["samy"].read()["samy"][
229
+ "value"
230
+ ]
297
231
  motor_absolute_widget.change_motors("samx", "samy")
298
232
 
299
233
  emitted_coordinates = []
@@ -306,8 +240,7 @@ def test_absolute_save_current_coordinates(motor_absolute_widget):
306
240
  # Trigger saving current coordinates
307
241
  motor_absolute_widget.pushButton_save.click()
308
242
 
309
- # Default position of samx and samy are 2.0 and 3.0 respectively
310
- assert emitted_coordinates == [(2.0, 3.0)]
243
+ assert emitted_coordinates == [(motor_x_value, motor_y_value)]
311
244
 
312
245
 
313
246
  def test_absolute_set_absolute_coordinates(motor_absolute_widget):
tests/test_motor_map.py CHANGED
@@ -1,9 +1,12 @@
1
1
  # pylint: disable = no-name-in-module,missing-module-docstring, missing-function-docstring
2
2
  from unittest.mock import MagicMock
3
+
3
4
  import pytest
4
5
 
5
6
  from bec_widgets.widgets import MotorMap
6
7
 
8
+ from .client_mocks import mocked_client
9
+
7
10
  CONFIG_DEFAULT = {
8
11
  "plot_settings": {
9
12
  "colormap": "Greys",
@@ -60,68 +63,6 @@ CONFIG_ONE_DEVICE = {
60
63
  }
61
64
 
62
65
 
63
- class FakeDevice:
64
- """Fake minimal positioner class for testing."""
65
-
66
- def __init__(self, name, enabled=True, limits=None, read_value=1.0):
67
- self.name = name
68
- self.enabled = enabled
69
- self.signals = {self.name: {"value": 1.0}}
70
- self.description = {self.name: {"source": self.name}}
71
- self.limits = limits if limits is not None else [0, 0]
72
- self.read_value = read_value
73
-
74
- def set_read_value(self, value):
75
- self.read_value = value
76
-
77
- def read(self):
78
- return {self.name: {"value": self.read_value}}
79
-
80
- def set_limits(self, limits):
81
- self.limits = limits
82
-
83
- def __contains__(self, item):
84
- return item == self.name
85
-
86
- @property
87
- def _hints(self):
88
- return [self.name]
89
-
90
- def set_value(self, fake_value: float = 1.0) -> None:
91
- """
92
- Setup fake value for device readout
93
- Args:
94
- fake_value(float): Desired fake value
95
- """
96
- self.signals[self.name]["value"] = fake_value
97
-
98
- def describe(self) -> dict:
99
- """
100
- Get the description of the device
101
- Returns:
102
- dict: Description of the device
103
- """
104
- return self.description
105
-
106
-
107
- @pytest.fixture
108
- def mocked_client():
109
- client = MagicMock()
110
-
111
- # Mocking specific motors with their limits
112
- motors = {
113
- "samx": FakeDevice("samx", limits=[-10, 10], read_value=2.0),
114
- "samy": FakeDevice("samy", limits=[-5, 5], read_value=3.0),
115
- "aptrx": FakeDevice("aptrx", read_value=4.0),
116
- "aptry": FakeDevice("aptry", read_value=5.0),
117
- }
118
-
119
- client.device_manager.devices = MagicMock()
120
- client.device_manager.devices.__getitem__.side_effect = lambda x: motors.get(x, FakeDevice(x))
121
-
122
- return client
123
-
124
-
125
66
  @pytest.fixture(scope="function")
126
67
  def motor_map(qtbot, mocked_client):
127
68
  widget = MotorMap(client=mocked_client)
@@ -143,12 +84,15 @@ def test_motor_limits_initialization(motor_map):
143
84
 
144
85
  def test_motor_initial_position(motor_map):
145
86
  motor_map.precision = 2
87
+
88
+ motor_map_dev = motor_map.client.device_manager.devices
89
+
146
90
  # Example test to check if motor initial positions are correctly initialized
147
91
  expected_positions = {
148
- ("samx", "samx"): 2.0,
149
- ("samy", "samy"): 3.0,
150
- ("aptrx", "aptrx"): 4.0,
151
- ("aptry", "aptry"): 5.0,
92
+ ("samx", "samx"): motor_map_dev["samx"].read()["samx"]["value"],
93
+ ("samy", "samy"): motor_map_dev["samy"].read()["samy"]["value"],
94
+ ("aptrx", "aptrx"): motor_map_dev["aptrx"].read()["aptrx"]["value"],
95
+ ("aptry", "aptry"): motor_map_dev["aptry"].read()["aptry"]["value"],
152
96
  }
153
97
  for (motor_name, entry), expected_position in expected_positions.items():
154
98
  actual_position = motor_map._get_motor_init_position(motor_name, entry)
tests/test_plot_base.py CHANGED
@@ -1,5 +1,6 @@
1
1
  # pylint: disable=missing-function-docstring, missing-module-docstring, unused-import
2
2
  import pytest
3
+
3
4
  from .client_mocks import mocked_client
4
5
  from .test_bec_figure import bec_figure
5
6
 
@@ -6,8 +6,8 @@ from unittest.mock import MagicMock
6
6
  import pytest
7
7
  from qtpy.QtWidgets import QLineEdit
8
8
 
9
- from bec_widgets.widgets import ScanControl
10
9
  from bec_widgets.utils.widget_io import WidgetIO
10
+ from bec_widgets.widgets import ScanControl
11
11
 
12
12
  from .test_msgs.available_scans_message import available_scans_message
13
13
 
tests/test_stream_plot.py CHANGED
@@ -1,11 +1,11 @@
1
1
  # pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
2
+ import threading
2
3
  from unittest import mock
3
4
 
4
5
  import numpy as np
5
6
  import pytest
6
- from bec_lib import messages, RedisConnector
7
+ from bec_lib import RedisConnector, messages
7
8
  from pytestqt import qtbot
8
- import threading
9
9
 
10
10
  from bec_widgets.examples.stream_plot.stream_plot import StreamPlot
11
11
 
@@ -1,11 +1,12 @@
1
1
  # pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
2
2
  import pytest
3
3
  from pydantic import ValidationError
4
+
4
5
  from bec_widgets.validation.monitor_config_validator import (
5
- MonitorConfigValidator,
6
- Signal,
7
6
  AxisSignal,
7
+ MonitorConfigValidator,
8
8
  PlotConfig,
9
+ Signal,
9
10
  )
10
11
 
11
12
  from .test_bec_monitor import mocked_client
@@ -84,7 +85,7 @@ def test_plot_config_no_source_type_provided(setup_devices):
84
85
  def test_plot_config_history_source_type(setup_devices):
85
86
  history_source = {
86
87
  "type": "history",
87
- "scanID": "valid_scan_id",
88
+ "scan_id": "valid_scan_id",
88
89
  "signals": {"x": [{"name": "samx"}], "y": [{"name": "samx"}]},
89
90
  }
90
91
 
@@ -92,7 +93,7 @@ def test_plot_config_history_source_type(setup_devices):
92
93
 
93
94
  assert len(plot_config.sources) == 1
94
95
  assert plot_config.sources[0].type == "history"
95
- assert plot_config.sources[0].scanID == "valid_scan_id"
96
+ assert plot_config.sources[0].scan_id == "valid_scan_id"
96
97
 
97
98
 
98
99
  def test_plot_config_redis_source_type(setup_devices):
tests/test_waveform1d.py CHANGED
@@ -4,7 +4,8 @@ from unittest.mock import MagicMock
4
4
  import numpy as np
5
5
  import pytest
6
6
 
7
- from bec_widgets.widgets.plots.waveform1d import SignalData, Signal, CurveConfig
7
+ from bec_widgets.widgets.plots.waveform1d import CurveConfig, Signal, SignalData
8
+
8
9
  from .client_mocks import mocked_client
9
10
  from .test_bec_figure import bec_figure
10
11
 
@@ -80,8 +81,20 @@ def test_create_waveform1D_by_config(bec_figure):
80
81
  "source": "scan_segment",
81
82
  "signals": {
82
83
  "source": "scan_segment",
83
- "x": {"name": "samx", "entry": "samx", "unit": None, "modifier": None},
84
- "y": {"name": "bpm4i", "entry": "bpm4i", "unit": None, "modifier": None},
84
+ "x": {
85
+ "name": "samx",
86
+ "entry": "samx",
87
+ "unit": None,
88
+ "modifier": None,
89
+ "limits": None,
90
+ },
91
+ "y": {
92
+ "name": "bpm4i",
93
+ "entry": "bpm4i",
94
+ "unit": None,
95
+ "modifier": None,
96
+ "limits": None,
97
+ },
85
98
  },
86
99
  },
87
100
  "curve-custom": {
@@ -217,8 +230,8 @@ def test_change_curve_appearance_methods(bec_figure, qtbot):
217
230
  assert c1.config.source == "scan_segment"
218
231
  assert c1.config.signals.model_dump() == {
219
232
  "source": "scan_segment",
220
- "x": {"name": "samx", "entry": "samx", "unit": None, "modifier": None},
221
- "y": {"name": "bpm4i", "entry": "bpm4i", "unit": None, "modifier": None},
233
+ "x": {"name": "samx", "entry": "samx", "unit": None, "modifier": None, "limits": None},
234
+ "y": {"name": "bpm4i", "entry": "bpm4i", "unit": None, "modifier": None, "limits": None},
222
235
  }
223
236
 
224
237
 
@@ -245,8 +258,8 @@ def test_change_curve_appearance_args(bec_figure):
245
258
  assert c1.config.source == "scan_segment"
246
259
  assert c1.config.signals.model_dump() == {
247
260
  "source": "scan_segment",
248
- "x": {"name": "samx", "entry": "samx", "unit": None, "modifier": None},
249
- "y": {"name": "bpm4i", "entry": "bpm4i", "unit": None, "modifier": None},
261
+ "x": {"name": "samx", "entry": "samx", "unit": None, "modifier": None, "limits": None},
262
+ "y": {"name": "bpm4i", "entry": "bpm4i", "unit": None, "modifier": None, "limits": None},
250
263
  }
251
264
 
252
265
 
@@ -338,8 +351,14 @@ def test_curve_add_by_config(bec_figure):
338
351
  "source": "scan_segment",
339
352
  "signals": {
340
353
  "source": "scan_segment",
341
- "x": {"name": "samx", "entry": "samx", "unit": None, "modifier": None},
342
- "y": {"name": "bpm4i", "entry": "bpm4i", "unit": None, "modifier": None},
354
+ "x": {"name": "samx", "entry": "samx", "unit": None, "modifier": None, "limits": None},
355
+ "y": {
356
+ "name": "bpm4i",
357
+ "entry": "bpm4i",
358
+ "unit": None,
359
+ "modifier": None,
360
+ "limits": None,
361
+ },
343
362
  },
344
363
  }
345
364
 
@@ -365,7 +384,7 @@ def test_scan_update(bec_figure, qtbot):
365
384
  "gauss_adc1": {"gauss_adc1": {"value": 8}},
366
385
  "gauss_adc2": {"gauss_adc2": {"value": 9}},
367
386
  },
368
- "scanID": 1,
387
+ "scan_id": 1,
369
388
  }
370
389
  # Mock scan_storage.find_scan_by_ID
371
390
  mock_scan_data_waveform = MagicMock()
@@ -400,8 +419,8 @@ def test_scan_history_with_val_access(bec_figure, qtbot):
400
419
  mock_scan_storage.find_scan_by_ID.return_value = MagicMock(data=mock_scan_data)
401
420
  w1.queue.scan_storage = mock_scan_storage
402
421
 
403
- fake_scanID = "fake_scanID"
404
- w1.scan_history(scanID=fake_scanID)
422
+ fake_scan_id = "fake_scan_id"
423
+ w1.scan_history(scan_id=fake_scan_id)
405
424
 
406
425
  qtbot.wait(500)
407
426
 
tests/test_widget_io.py CHANGED
@@ -1,13 +1,6 @@
1
1
  # pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
2
2
  import pytest
3
- from qtpy.QtWidgets import (
4
- QWidget,
5
- QVBoxLayout,
6
- QLineEdit,
7
- QComboBox,
8
- QTableWidget,
9
- QSpinBox,
10
- )
3
+ from qtpy.QtWidgets import QComboBox, QLineEdit, QSpinBox, QTableWidget, QVBoxLayout, QWidget
11
4
 
12
5
  from bec_widgets.utils.widget_io import WidgetHierarchy
13
6
 
tests/test_yaml_dialog.py CHANGED
@@ -2,9 +2,10 @@
2
2
  import os
3
3
  import tempfile
4
4
  from unittest.mock import patch
5
+
5
6
  import pytest
6
7
  import yaml
7
- from qtpy.QtWidgets import QWidget, QVBoxLayout, QPushButton
8
+ from qtpy.QtWidgets import QPushButton, QVBoxLayout, QWidget
8
9
 
9
10
  from bec_widgets.utils.yaml_dialog import load_yaml, save_yaml
10
11