mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
refactor: applied formatter
This commit is contained in:
@ -41,14 +41,7 @@ def send_msg_event():
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"topics_msg_list",
|
||||
[
|
||||
(
|
||||
("topic1", dummy_msg),
|
||||
("topic2", dummy_msg),
|
||||
("topic3", dummy_msg),
|
||||
)
|
||||
],
|
||||
"topics_msg_list", [(("topic1", dummy_msg), ("topic2", dummy_msg), ("topic3", dummy_msg))]
|
||||
)
|
||||
def test_dispatcher_disconnect_all(bec_dispatcher_w_connector, qtbot, send_msg_event):
|
||||
bec_dispatcher = bec_dispatcher_w_connector
|
||||
@ -70,15 +63,7 @@ def test_dispatcher_disconnect_all(bec_dispatcher_w_connector, qtbot, send_msg_e
|
||||
assert len(bec_dispatcher.client.connector._topics_cb) == 0
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"topics_msg_list",
|
||||
[
|
||||
(
|
||||
("topic1", dummy_msg),
|
||||
("topic2", dummy_msg),
|
||||
)
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("topics_msg_list", [(("topic1", dummy_msg), ("topic2", dummy_msg))])
|
||||
def test_dispatcher_disconnect_one(bec_dispatcher_w_connector, qtbot, send_msg_event):
|
||||
# test for BEC issue #276
|
||||
bec_dispatcher = bec_dispatcher_w_connector
|
||||
@ -115,15 +100,7 @@ def test_dispatcher_2_cb_same_topic(bec_dispatcher_w_connector, qtbot, send_msg_
|
||||
cb2.assert_called_once()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"topics_msg_list",
|
||||
[
|
||||
(
|
||||
("topic1", dummy_msg),
|
||||
("topic2", dummy_msg),
|
||||
)
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("topics_msg_list", [(("topic1", dummy_msg), ("topic2", dummy_msg))])
|
||||
def test_dispatcher_2_topic_same_cb(bec_dispatcher_w_connector, qtbot, send_msg_event):
|
||||
# test for BEC issue #276
|
||||
bec_dispatcher = bec_dispatcher_w_connector
|
||||
|
@ -26,11 +26,7 @@ def test_bec_figure_init(bec_figure):
|
||||
|
||||
|
||||
def test_bec_figure_init_with_config(mocked_client):
|
||||
config = {
|
||||
"widget_class": "BECFigure",
|
||||
"gui_id": "test_gui_id",
|
||||
"theme": "dark",
|
||||
}
|
||||
config = {"widget_class": "BECFigure", "gui_id": "test_gui_id", "theme": "dark"}
|
||||
widget = BECFigure(client=mocked_client, config=config)
|
||||
assert widget.config.gui_id == "test_gui_id"
|
||||
assert widget.config.theme == "dark"
|
||||
|
@ -29,10 +29,7 @@ def test_motor_map_change_motors(bec_motor_map):
|
||||
|
||||
|
||||
def test_motor_map_get_limits(bec_motor_map):
|
||||
expected_limits = {
|
||||
"samx": [-10, 10],
|
||||
"samy": [-5, 5],
|
||||
}
|
||||
expected_limits = {"samx": [-10, 10], "samy": [-5, 5]}
|
||||
|
||||
for motor_name, expected_limit in expected_limits.items():
|
||||
actual_limit = bec_motor_map._get_motor_limit(motor_name)
|
||||
|
@ -43,11 +43,7 @@ def test_load_config(config_dialog, config_name):
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"config_name, scan_mode",
|
||||
[
|
||||
("config_device", False),
|
||||
("config_scan", True),
|
||||
("config_device_no_entry", False),
|
||||
],
|
||||
[("config_device", False), ("config_scan", True), ("config_device_no_entry", False)],
|
||||
)
|
||||
def test_initialization(config_dialog, config_name, scan_mode):
|
||||
config = load_test_config(config_name)
|
||||
|
@ -50,7 +50,7 @@ CONFIG_DEFAULT = {
|
||||
"x": [{"name": "samx", "entry": "samx"}],
|
||||
"y": [{"name": "samy", "entry": "samy"}],
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ CONFIG_ONE_DEVICE = {
|
||||
"x": [{"name": "samx", "entry": "samx"}],
|
||||
"y": [{"name": "samy", "entry": "samy"}],
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@ -73,10 +73,7 @@ def motor_map(qtbot, mocked_client):
|
||||
|
||||
def test_motor_limits_initialization(motor_map):
|
||||
# Example test to check if motor limits are correctly initialized
|
||||
expected_limits = {
|
||||
"samx": [-10, 10],
|
||||
"samy": [-5, 5],
|
||||
}
|
||||
expected_limits = {"samx": [-10, 10], "samy": [-5, 5]}
|
||||
for motor_name, expected_limit in expected_limits.items():
|
||||
actual_limit = motor_map._get_motor_limit(motor_name)
|
||||
assert actual_limit == expected_limit
|
||||
@ -99,13 +96,7 @@ def test_motor_initial_position(motor_map):
|
||||
assert actual_position == expected_position
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"config, number_of_plots",
|
||||
[
|
||||
(CONFIG_DEFAULT, 2),
|
||||
(CONFIG_ONE_DEVICE, 1),
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("config, number_of_plots", [(CONFIG_DEFAULT, 2), (CONFIG_ONE_DEVICE, 1)])
|
||||
def test_initialization(motor_map, config, number_of_plots):
|
||||
config_load = config
|
||||
motor_map.on_config_update(config_load)
|
||||
@ -131,16 +122,10 @@ def test_motor_movement_updates_position_and_database(motor_map):
|
||||
motor_map.on_device_readback({"signals": {"samx": {"value": new_position_samx}}})
|
||||
|
||||
# Verify database update for 'samx'
|
||||
assert motor_map.database["samx"]["samx"] == [
|
||||
initial_position_samx,
|
||||
new_position_samx,
|
||||
]
|
||||
assert motor_map.database["samx"]["samx"] == [initial_position_samx, new_position_samx]
|
||||
|
||||
# Verify 'samy' retains its last known position
|
||||
assert motor_map.database["samy"]["samy"] == [
|
||||
initial_position_samy,
|
||||
initial_position_samy,
|
||||
]
|
||||
assert motor_map.database["samy"]["samy"] == [initial_position_samy, initial_position_samy]
|
||||
|
||||
|
||||
def test_scatter_plot_rendering(motor_map):
|
||||
|
@ -85,12 +85,7 @@ def test_1d_plotting_data(qtbot, stream_app):
|
||||
def test_flip_even_rows(qtbot, stream_app):
|
||||
# Create a numpy array with some known data
|
||||
original_array = np.array(
|
||||
[
|
||||
[1, 2, 3, 4, 5],
|
||||
[6, 7, 8, 9, 10],
|
||||
[11, 12, 13, 14, 15],
|
||||
[16, 17, 18, 19, 20],
|
||||
]
|
||||
[[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]
|
||||
)
|
||||
|
||||
# Call flip_even_rows on the original array
|
||||
@ -98,12 +93,7 @@ def test_flip_even_rows(qtbot, stream_app):
|
||||
|
||||
# Expected array flipped along the rows with even indices
|
||||
expected_array = np.array(
|
||||
[
|
||||
[1, 2, 3, 4, 5],
|
||||
[10, 9, 8, 7, 6],
|
||||
[11, 12, 13, 14, 15],
|
||||
[20, 19, 18, 17, 16],
|
||||
]
|
||||
[[1, 2, 3, 4, 5], [10, 9, 8, 7, 6], [11, 12, 13, 14, 15], [20, 19, 18, 17, 16]]
|
||||
)
|
||||
|
||||
# Check that flip_even_rows returned the expected result
|
||||
|
Reference in New Issue
Block a user