Skip to content

Commit

Permalink
[MRG] Added data check on axes in test_gui.py (#726)
Browse files Browse the repository at this point in the history
* add data check on axes in `test_gui.py`

Signed-off-by: samadpls <abdulsamadsid1@gmail.com>

* refactored

Signed-off-by: samadpls <abdulsamadsid1@gmail.com>

* Added tests for GUI visualization features

Signed-off-by: samadpls <abdulsamadsid1@gmail.com>

* fixed linting error

Signed-off-by: samadpls <abdulsamadsid1@gmail.com>

* added doc string

Signed-off-by: samadpls <abdulsamadsid1@gmail.com>

* Remove unnecessary code assertions

Signed-off-by: samadpls <abdulsamadsid1@gmail.com>

* Refactor visualization test

Signed-off-by: samadpls <abdulsamadsid1@gmail.com>

* refactor

---------

Signed-off-by: samadpls <abdulsamadsid1@gmail.com>
  • Loading branch information
samadpls authored Mar 13, 2024
1 parent 3c205e5 commit 21dcea5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions hnn_core/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ def test_gui_figure_overlay():


def test_gui_adaptive_spectrogram():
"""Test the adaptive spectrogram functionality of the HNNGUI."""
gui = HNNGUI()
gui.compose()
gui.params['N_pyr_x'] = 3
Expand All @@ -422,6 +423,34 @@ def test_gui_adaptive_spectrogram():
plt.close('all')


@pytest.fixture
def setup_gui():
gui = HNNGUI()
gui.compose()
gui.params['N_pyr_x'] = 3
gui.params['N_pyr_y'] = 3
gui.run_button.click()
return gui


@pytest.mark.parametrize("viz_type", ["layer2 dipole", "layer5 dipole",
"spikes", "PSD", "network"])
def test_gui_visualization(setup_gui, viz_type):
"""Test visualization functionality in the HNNGUI."""
gui = setup_gui
figid = 1
figname = f'Figure {figid}'
axname = 'ax1'
gui._simulate_viz_action("edit_figure", figname,
axname, 'default', viz_type, {}, 'clear')
gui._simulate_viz_action("edit_figure", figname,
axname, 'default', viz_type, {}, 'plot')
# Check if data is plotted on the axes
assert len(gui.viz_manager.figs[figid].axes) == 2
# Check default figs have data on their axis
assert gui.viz_manager.figs[figid].axes[1].has_data()


def test_unlink_relink_widget():
"""Tests the unlinking and relinking of widgets decorator."""

Expand Down

0 comments on commit 21dcea5

Please sign in to comment.