Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Added data check on axes in test_gui.py #726

Merged
merged 8 commits into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol ... I'm glad I made you do this ;-)

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
Loading