-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from cibr-jyu/add-action-tests
Add action tests
- Loading branch information
Showing
57 changed files
with
1,223 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ check: | |
|
||
.PHONY: test | ||
test: | ||
pytest -s | ||
pytest | ||
|
||
.PHONY: update_docs | ||
update_docs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.epochs_delete import DeleteEpochs | ||
|
||
|
||
class TestEpochsDelete(BaseTestAction): | ||
def test_epochs_delete(self): | ||
|
||
data = {"outputs": {"epochs": ["Epochs"]}} | ||
|
||
self.run_action( | ||
action_name="epochs_delete", | ||
handler=DeleteEpochs, | ||
data=data, | ||
patch_paths=["meggie.actions.epochs_delete"], | ||
) |
15 changes: 15 additions & 0 deletions
15
meggie/actions/epochs_delete_from_all/tests/test_epochs_delete_from_all.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.epochs_delete_from_all import DeleteEpochsFromAll | ||
|
||
|
||
class TestEpochsDeleteFromAll(BaseTestAction): | ||
def test_epochs_delete_from_all(self): | ||
|
||
data = {"outputs": {"epochs": ["Epochs"]}} | ||
|
||
self.run_action( | ||
action_name="epochs_delete_from_all", | ||
handler=DeleteEpochsFromAll, | ||
data=data, | ||
patch_paths=["meggie.actions.epochs_delete_from_all"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.epochs_info import Info | ||
|
||
|
||
class TestEpochsInfo(BaseTestAction): | ||
def test_epochs_info(self): | ||
|
||
data = {"outputs": {"epochs": ["Epochs"]}} | ||
|
||
content = self.run_action( | ||
action_name="epochs_info", | ||
handler=Info, | ||
data=data, | ||
patch_paths=["meggie.actions.epochs_info"], | ||
) | ||
assert content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.epochs_plot import PlotEpochs | ||
|
||
|
||
class TestEpochsPlot(BaseTestAction): | ||
def test_epochs_plot(self): | ||
|
||
data = {"outputs": {"epochs": ["Epochs"]}} | ||
|
||
self.run_action( | ||
action_name="epochs_plot", | ||
handler=PlotEpochs, | ||
data=data, | ||
patch_paths=["meggie.actions.epochs_plot"], | ||
) |
15 changes: 15 additions & 0 deletions
15
meggie/actions/epochs_plot_image/tests/test_epochs_plot_image.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.epochs_plot_image import PlotEpochsImage | ||
|
||
|
||
class TestEpochsPlotImage(BaseTestAction): | ||
def test_epochs_plot_image(self): | ||
|
||
data = {"outputs": {"epochs": ["Epochs"]}} | ||
|
||
self.run_action( | ||
action_name="epochs_plot_image", | ||
handler=PlotEpochsImage, | ||
data=data, | ||
patch_paths=["meggie.actions.epochs_plot_image"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.evoked_create import CreateEvoked | ||
from meggie.utilities.dialogs.simpleDialogMain import SimpleDialog | ||
|
||
|
||
class TestEvokedCreate(BaseTestAction): | ||
def test_evoked_create(self): | ||
|
||
data = {"inputs": {"epochs": ["Epochs"]}} | ||
|
||
self.run_action( | ||
action_name="evoked_create", | ||
handler=CreateEvoked, | ||
data=data, | ||
patch_paths=["meggie.utilities.dialogs.simpleDialogMain"], | ||
) | ||
dialog = self.find_dialog(SimpleDialog) | ||
dialog.accept() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.evoked_delete import DeleteEvoked | ||
|
||
|
||
class TestEvokedDelete(BaseTestAction): | ||
def test_evoked_delete(self): | ||
|
||
data = {"outputs": {"evoked": ["Evoked"]}} | ||
|
||
self.run_action( | ||
action_name="evoked_delete", | ||
handler=DeleteEvoked, | ||
data=data, | ||
patch_paths=["meggie.actions.evoked_delete"], | ||
) |
15 changes: 15 additions & 0 deletions
15
meggie/actions/evoked_delete_from_all/tests/test_evoked_delete_from_all.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.evoked_delete_from_all import DeleteEvokedFromAll | ||
|
||
|
||
class TestEvokedDeleteFromAll(BaseTestAction): | ||
def test_evoked_delete_from_all(self): | ||
|
||
data = {"outputs": {"evoked": ["Evoked"]}} | ||
|
||
self.run_action( | ||
action_name="evoked_delete_from_all", | ||
handler=DeleteEvokedFromAll, | ||
data=data, | ||
patch_paths=["meggie.actions.evoked_delete_from_all"], | ||
) |
28 changes: 28 additions & 0 deletions
28
meggie/actions/evoked_group_average/tests/test_evoked_group_average.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
19
meggie/actions/evoked_plot/tests/test_evoked_plot_all_channels.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 TestEvokedPlotAllChannels(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() |
19 changes: 19 additions & 0 deletions
19
meggie/actions/evoked_plot/tests/test_evoked_plot_channel_averages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 TestEvokedPlotChannelAverages(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() |
22 changes: 22 additions & 0 deletions
22
meggie/actions/evoked_plot_topomap/tests/test_evoked_plot_topomap.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.evoked_plot_topomap import PlotEvokedTopomap | ||
from meggie.actions.evoked_plot_topomap.dialogs.evokedTopomapDialogMain import ( | ||
EvokedTopomapDialog, | ||
) | ||
|
||
|
||
class TestEvokedPlotTopomap(BaseTestAction): | ||
def test_evoked_plot_topomap(self): | ||
|
||
data = {"outputs": {"evoked": ["Evoked"]}} | ||
|
||
self.run_action( | ||
action_name="evoked_plot_topomap", | ||
handler=PlotEvokedTopomap, | ||
data=data, | ||
patch_paths=[ | ||
"meggie.actions.evoked_plot_topomap.dialogs.evokedTopomapDialogMain" | ||
], | ||
) | ||
dialog = self.find_dialog(EvokedTopomapDialog) | ||
dialog.accept() |
19 changes: 19 additions & 0 deletions
19
meggie/actions/evoked_save/tests/test_evoked_save_all_channels.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.evoked_save import SaveEvoked | ||
from meggie.utilities.dialogs.outputOptionsMain import OutputOptions | ||
|
||
|
||
class TestEvokedSaveAllChannels(BaseTestAction): | ||
def test_evoked_save_all_channels(self): | ||
|
||
data = {"outputs": {"evoked": ["Evoked"]}} | ||
|
||
self.run_action( | ||
action_name="evoked_save", | ||
handler=SaveEvoked, | ||
data=data, | ||
patch_paths=["meggie.actions.evoked_save"], | ||
) | ||
dialog = self.find_dialog(OutputOptions) | ||
dialog.ui.radioButtonChannelAverages.setChecked(False) | ||
dialog.accept() |
19 changes: 19 additions & 0 deletions
19
meggie/actions/evoked_save/tests/test_evoked_save_channel_averages.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.evoked_save import SaveEvoked | ||
from meggie.utilities.dialogs.outputOptionsMain import OutputOptions | ||
|
||
|
||
class TestEvokedSaveChannelAverages(BaseTestAction): | ||
def test_evoked_save_channel_averages(self): | ||
|
||
data = {"outputs": {"evoked": ["Evoked"]}} | ||
|
||
self.run_action( | ||
action_name="evoked_save", | ||
handler=SaveEvoked, | ||
data=data, | ||
patch_paths=["meggie.actions.evoked_save"], | ||
) | ||
dialog = self.find_dialog(OutputOptions) | ||
dialog.ui.radioButtonChannelAverages.setChecked(True) | ||
dialog.accept() |
13 changes: 13 additions & 0 deletions
13
meggie/actions/raw_event_info/tests/test_raw_event_info.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.raw_event_info import Info | ||
|
||
|
||
class TestRawEventInfo(BaseTestAction): | ||
def test_raw_event_info(self): | ||
|
||
content = self.run_action( | ||
action_name="raw_event_info", | ||
handler=Info, | ||
patch_paths=["meggie.actions.raw_event_info"], | ||
) | ||
assert content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
meggie/actions/raw_events_from_annotations/tests/test_raw_events_from_annotations.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import mne | ||
|
||
from meggie.utilities.testing import BaseTestAction | ||
from meggie.actions.raw_events_from_annotations import EventsFromAnnotations | ||
from meggie.actions.raw_events_from_annotations.dialogs.eventsFromAnnotationsDialogMain import ( | ||
EventsFromAnnotationsDialog, | ||
) | ||
|
||
|
||
class TestRawEventsFromAnnotations(BaseTestAction): | ||
|
||
def setup_experiment(self): | ||
BaseTestAction.setup_experiment(self) | ||
raw = self.experiment.active_subject.get_raw() | ||
|
||
# create one annotation named "CAT" | ||
annotations = mne.Annotations([2], [1], ["CAT"]) | ||
raw.set_annotations(annotations) | ||
|
||
def test_raw_events_from_annotations(self): | ||
self.run_action( | ||
action_name="raw_events_from_annotations", | ||
handler=EventsFromAnnotations, | ||
patch_paths=[ | ||
"meggie.actions.raw_events_from_annotations.dialogs.eventsFromAnnotationsDialogMain" | ||
], | ||
) | ||
dialog = self.find_dialog(EventsFromAnnotationsDialog) | ||
dialog.items = [("CAT", 99, True)] | ||
dialog.accept() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.