Skip to content

Commit

Permalink
TST: Added new test cases on test_gui_upload_csv_simulation. Fixed fl…
Browse files Browse the repository at this point in the history
…ake8 errors
  • Loading branch information
kmilo9999 committed May 8, 2024
1 parent 4e4221b commit 92c67a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hnn_core/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,10 +1452,10 @@ def _serialize_simulation(log_out, sim_data, simulation_list_widget):

def serialize_simulation(simulations_data, simulation_name):
"""Serializes simulation data to CSV.
Creates a single CSV file or a ZIP file containing multiple CSVs,
Creates a single CSV file or a ZIP file containing multiple CSVs,
depending on the number of trials in the simulation.
"""
simulation_data = simulations_data["simulation_data"]
csv_trials_output = []
Expand Down
11 changes: 11 additions & 0 deletions hnn_core/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,19 @@ def test_gui_upload_csv_simulation():
file_url = 'file://' + absolute_path
_ = gui._simulate_upload_data(file_url)

# we are loading only 1 trial,
# assume all the data we need is in the [0] position
data_lengh = (
len(gui.data['simulation_data']['test_default']['dpls'][0].times))

assert len(gui.data['simulation_data']) == 1
assert 'test_default' in gui.data['simulation_data'].keys()
assert gui.data['simulation_data']['test_default']['net'] is None
assert type(gui.data['simulation_data']['test_default']['dpls']) is list
assert len(gui.viz_manager.data['figs']) == 1
assert (len(gui.data['simulation_data']['test_default']
['dpls'][0].data['agg']) == data_lengh)
assert (len(gui.data['simulation_data']['test_default']
['dpls'][0].data['L2']) == data_lengh)
assert (len(gui.data['simulation_data']['test_default']
['dpls'][0].data['L5']) == data_lengh)

0 comments on commit 92c67a6

Please sign in to comment.