0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

refactor: made client a module import

This commit is contained in:
2023-08-10 18:12:21 +02:00
parent f75554bd7b
commit dc5fd9959f
3 changed files with 122 additions and 95 deletions

View File

@ -13,12 +13,25 @@ def test_scan_plot(qtbot):
plot.x_channel = "x"
plot.y_channel_list = ["y1", "y2"]
plot.initialize()
plot.redraw_scan(
{"x": {"x": {"value": 1}}, "y1": {"y1": {"value": 1}}, "y2": {"y2": {"value": 3}}}
plot.on_scan_segment(
{
"data": {
"x": {"x": {"value": 1}},
"y1": {"y1": {"value": 1}},
"y2": {"y2": {"value": 3}},
}
},
{"scanID": "test", "scan_number": 1, "scan_report_devices": ["x"]},
)
plot.redraw_scan(
{"x": {"x": {"value": 2}}, "y1": {"y1": {"value": 2}}, "y2": {"y2": {"value": 4}}}
plot.on_scan_segment(
{
"data": {
"x": {"x": {"value": 2}},
"y1": {"y1": {"value": 2}},
"y2": {"y2": {"value": 4}},
}
},
{"scanID": "test", "scan_number": 1, "scan_report_devices": ["x"]},
)
assert all(plot.scan_curves["y1"].getData()[0] == [1, 2])
@ -35,13 +48,26 @@ def test_scan_plot_clears_data(qtbot):
plot.x_channel = "x"
plot.y_channel_list = ["y1", "y2"]
plot.initialize()
plot.redraw_scan(
{"x": {"x": {"value": 1}}, "y1": {"y1": {"value": 1}}, "y2": {"y2": {"value": 3}}}
plot.on_scan_segment(
{
"data": {
"x": {"x": {"value": 1}},
"y1": {"y1": {"value": 1}},
"y2": {"y2": {"value": 3}},
}
},
{"scanID": "test", "scan_number": 1, "scan_report_devices": ["x"]},
)
plot.clearData()
plot.redraw_scan(
{"x": {"x": {"value": 2}}, "y1": {"y1": {"value": 2}}, "y2": {"y2": {"value": 4}}}
plot.on_new_scan({}, {})
plot.on_scan_segment(
{
"data": {
"x": {"x": {"value": 2}},
"y1": {"y1": {"value": 2}},
"y2": {"y2": {"value": 4}},
}
},
{"scanID": "test", "scan_number": 1, "scan_report_devices": ["x"]},
)
assert all(plot.scan_curves["y1"].getData()[0] == [2])
@ -57,8 +83,7 @@ def test_scan_plot_redraws_dap(qtbot):
plot.y_channel_list = ["dap.y1", "dap.y2"]
plot.initialize()
plot.redraw_dap({"y1": {"x": [1], "y": [1]}, "y2": {"x": [2], "y": [2]}})
plot.redraw_dap({"y1": {"x": [1], "y": [1]}, "y2": {"x": [2], "y": [2]}}, {})
assert all(plot.dap_curves["y1"].getData()[0] == [1])
assert all(plot.dap_curves["y2"].getData()[1] == [2])