From f80aaee8aaf347ffa26056ae32abe7af3d769566 Mon Sep 17 00:00:00 2001 From: Camilo Diaz Date: Wed, 1 May 2024 10:24:24 -0400 Subject: [PATCH] TST: added download simulation test --- hnn_core/tests/test_gui.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/hnn_core/tests/test_gui.py b/hnn_core/tests/test_gui.py index 3b3fc902db..6448eeb775 100644 --- a/hnn_core/tests/test_gui.py +++ b/hnn_core/tests/test_gui.py @@ -563,3 +563,41 @@ def add_child_decorated(self, to_add): # Check if the widgets are relinked, the selected index should be synced gui.tab_group_1.selected_index = 0 assert gui.tab_group_2.selected_index == 0 + + +def test_gui_download_simulation(): + """Test the GUI download simulation pipeline.""" + gui = HNNGUI() + _ = gui.compose() + gui.params['N_pyr_x'] = 3 + gui.params['N_pyr_y'] = 3 + + # Run a simulation with 3 trials + gui.widget_dt.value = 0.85 + gui.widget_ntrials.value = 3 + + # set synch inputs to first driver in simulation + sim_name = "sim1" + gui.widget_simulation_name.value = sim_name + + # Run simulation + gui.run_button.click() + serialized_simulation_data, file_extension = ( + gui.viz_manager.serialize_simulation(sim_name)) + # result is a zip file + assert file_extension == ".zip" + + # Run a simulation with 1 trials + gui.widget_dt.value = 0.85 + gui.widget_ntrials.value = 1 + + # set synch inputs to first driver in simulation + sim_name2 = "sim2" + gui.widget_simulation_name.value = sim_name2 + + # Run simulation + gui.run_button.click() + serialized_simulation_data, file_extension = ( + gui.viz_manager.serialize_simulation(sim_name2)) + # result is a single csv file + assert file_extension == ".csv"