From 72eb0df142da7287e53732d0f5f5ac469dc9e712 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Wed, 24 Jul 2024 14:51:46 -0400 Subject: [PATCH] TST: Added unit test checking dropdown positions in gui --- hnn_core/gui/_viz_manager.py | 2 +- hnn_core/tests/test_gui.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/hnn_core/gui/_viz_manager.py b/hnn_core/gui/_viz_manager.py index e8c1a514c..695efe1d0 100644 --- a/hnn_core/gui/_viz_manager.py +++ b/hnn_core/gui/_viz_manager.py @@ -845,7 +845,7 @@ def reset_fig_config_tabs(self, template_name=None): simulation_data_selection = ax_control.children[1] simulation_data_selection.options = simulation_names - # Update the options for the simulation to compare dropdown + # Update the options for the data to compare dropdown simulation_to_compare = ax_control.children[4] simulation_to_compare.options = simulation_names diff --git a/hnn_core/tests/test_gui.py b/hnn_core/tests/test_gui.py index 855d06574..58eb63220 100644 --- a/hnn_core/tests/test_gui.py +++ b/hnn_core/tests/test_gui.py @@ -741,3 +741,38 @@ def test_gui_cell_params_widgets(setup_gui): assert (len(cell_params['Synapses']) == 12) assert (len(cell_params['Biophysics L2']) == 10) assert (len(cell_params['Biophysics L5']) == 20) + + +def test_fig_tabs_dropdown_lists(setup_gui): + """Test the GUI download simulation pipeline.""" + + gui = setup_gui + + gui.widget_ntrials.value = 1 + + # Initiate 1rs simulation + sim_name = "sim1" + gui.widget_simulation_name.value = sim_name + + # Run simulation + gui.run_button.click() + + # Initiate 2nd simulation + sim_name2 = "sim2" + gui.widget_simulation_name.value = sim_name2 + + # Run simulation + gui.run_button.click() + + viz_tabs = gui.viz_manager.axes_config_tabs.children + for tab in viz_tabs: + controls = tab.children[1] + for ax_control in controls.children: + assert ax_control.children[1].description == "Simulation Data:" + sim_names = ax_control.children[1].options + assert all(sim in sim_names for sim in [sim_name, sim_name2]) + + assert ax_control.children[4].description == "Data to Compare:" + + if ax_control.children[0].value != "input histogram": + assert not ax_control.children[4].disabled