Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
teekuningas committed Feb 28, 2024
1 parent 5de3389 commit d380833
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 2 deletions.
2 changes: 1 addition & 1 deletion meggie/actions/epochs_plot/tests/test_epochs_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from meggie.actions.epochs_plot import PlotEpochs


class TestPlotEpochs(BaseTestAction):
class TestEpochsPlot(BaseTestAction):
def test_epochs_plot(self):

data = {"outputs": {"epochs": ["Epochs"]}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from meggie.actions.epochs_plot_image import PlotEpochsImage


class TestPlotEpochsImage(BaseTestAction):
class TestEpochsPlotImage(BaseTestAction):
def test_epochs_plot_image(self):

data = {"outputs": {"epochs": ["Epochs"]}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from PyQt5 import QtCore

from meggie.utilities.testing import BaseTestAction
from meggie.actions.evoked_group_average import GroupAverage
from meggie.utilities.dialogs.groupSelectionDialogMain import (
GroupSelectionDialog,
)


class TestEvokedGroupAverage(BaseTestAction):
def test_evoked_group_average(self):

data = {"outputs": {"evoked": ["Evoked"]}}

self.run_action(
action_name="evoked_group_average",
handler=GroupAverage,
data=data,
patch_paths=["meggie.actions.evoked_group_average"],
)
dialog = self.find_dialog(GroupSelectionDialog)

dialog.ui.checkBoxGroup_0.setCheckState(QtCore.Qt.Checked)
dialog.ui.spinBoxGroup_0.setValue(1)
dialog.ui.checkBoxGroup_1.setCheckState(QtCore.Qt.Checked)
dialog.ui.spinBoxGroup_1.setValue(2)

dialog.accept()
16 changes: 16 additions & 0 deletions meggie/actions/evoked_info/tests/test_evoked_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from meggie.utilities.testing import BaseTestAction
from meggie.actions.evoked_info import Info


class TestEvokedInfo(BaseTestAction):
def test_evoked_info(self):

data = {"outputs": {"evoked": ["Evoked"]}}

content = self.run_action(
action_name="evoked_info",
handler=Info,
data=data,
patch_paths=["meggie.actions.evoked_info"],
)
assert content
19 changes: 19 additions & 0 deletions meggie/actions/evoked_plot/tests/test_evoked_plot_all_channels.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from meggie.utilities.testing import BaseTestAction
from meggie.actions.evoked_plot import PlotEvoked
from meggie.utilities.dialogs.outputOptionsMain import OutputOptions


class TestEvokedPlot(BaseTestAction):
def test_evoked_plot_all_channels(self):

data = {"outputs": {"evoked": ["Evoked"]}}

self.run_action(
action_name="evoked_plot",
handler=PlotEvoked,
data=data,
patch_paths=["meggie.actions.evoked_plot"],
)
dialog = self.find_dialog(OutputOptions)
dialog.ui.radioButtonChannelAverages.setChecked(False)
dialog.accept()
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from meggie.utilities.testing import BaseTestAction
from meggie.actions.evoked_plot import PlotEvoked
from meggie.utilities.dialogs.outputOptionsMain import OutputOptions


class TestEvokedPlot(BaseTestAction):
def test_evoked_plot_channel_averages(self):

data = {"outputs": {"evoked": ["Evoked"]}}

self.run_action(
action_name="evoked_plot",
handler=PlotEvoked,
data=data,
patch_paths=["meggie.actions.evoked_plot"],
)
dialog = self.find_dialog(OutputOptions)
dialog.ui.radioButtonChannelAverages.setChecked(True)
dialog.accept()
2 changes: 2 additions & 0 deletions meggie/utilities/testing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import tempfile
import logging
import importlib
import matplotlib
import pytest
import json
import os
Expand All @@ -13,6 +14,7 @@

os.environ["QT_QPA_PLATFORM"] = "offscreen"
mne.viz.set_browser_backend("matplotlib")
matplotlib.use("Agg")


class MockMainWindow(QMainWindow):
Expand Down

0 comments on commit d380833

Please sign in to comment.