Skip to content

Commit 5ada9ec

Browse files
committed
BUG: return print to warn and expect warn in test
1 parent 931a0b9 commit 5ada9ec

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

mne/evoked.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,7 @@ def _check_evokeds_ch_names_times(all_evoked, inplace=False):
15641564
if set(ev.ch_names) != set(ch_names):
15651565
raise ValueError(f"{evoked} and {ev} do not contain the same channels.")
15661566
else:
1567-
print("Order of channels differs, reordering channels ...")
1567+
warn("Order of channels differs, reordering channels ...")
15681568
if not inplace:
15691569
ev = ev.copy()
15701570
ev.reorder_channels(ch_names)

mne/viz/tests/test_evoked.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,11 @@ def test_plot_compare_evokeds(evoked):
478478
evoked_subset = evoked.copy().pick(["MEG 0113", "MEG 0112"])
479479
evoked_reordered = evoked_subset.copy()
480480
evoked_reordered.reorder_channels(["MEG 0112", "MEG 0113"])
481-
figs = plot_compare_evokeds(
482-
dict(orig=evoked_subset, reordered=evoked_reordered), axes="topo"
483-
)
481+
# catch warnings when testing misalignment on purpose
482+
with pytest.warns(RuntimeWarning, match="Order of channels differs"):
483+
figs = plot_compare_evokeds(
484+
dict(orig=evoked_subset, reordered=evoked_reordered), axes="topo"
485+
)
484486
assert_allclose(
485487
figs[0].axes[0].lines[0].get_ydata(), figs[0].axes[0].lines[1].get_ydata()
486488
)

0 commit comments

Comments
 (0)