Skip to content

Commit 0468218

Browse files
committed
Add test_add_forward
1 parent 0d547dd commit 0468218

4 files changed

Lines changed: 28 additions & 660 deletions

File tree

mne/report/report.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,7 @@ def add_forward(
15591559
subjects_dir=subjects_dir,
15601560
title=title,
15611561
image_format=self.image_format,
1562-
section=title,
1562+
section=section,
15631563
tags=tags,
15641564
replace=replace,
15651565
)
@@ -3600,7 +3600,7 @@ def _add_forward(
36003600
replace=replace,
36013601
)
36023602

3603-
if self.subject:
3603+
if subject:
36043604
src = forward["src"]
36053605
trans = forward["mri_head_t"]
36063606
# Alignment
@@ -3615,7 +3615,7 @@ def _add_forward(
36153615
eeg=dict(original=0.2, projected=0.8),
36163616
coord_frame="mri",
36173617
)
3618-
img, caption = _iterate_trans_views(
3618+
img, _ = _iterate_trans_views(
36193619
function=plot_alignment,
36203620
alpha=0.5,
36213621
max_width=self.img_max_width,
@@ -3666,7 +3666,7 @@ def _add_forward(
36663666
coord_frame="mri",
36673667
surfaces=surfaces,
36683668
)
3669-
img, caption = _iterate_alignment_views(
3669+
img, _ = _iterate_alignment_views(
36703670
function=plot_alignment,
36713671
alpha=0.5,
36723672
max_width=self.img_max_width,

mne/report/tests/test_report.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,28 @@ def test_add_bem_n_jobs(n_jobs, monkeypatch):
514514
assert 0.778 < corr < 0.80
515515

516516

517+
@pytest.mark.filterwarnings("ignore:Distances could not be calculated.*:RuntimeWarning")
518+
@pytest.mark.slowtest
519+
@testing.requires_testing_data
520+
def test_add_forward():
521+
report = Report(subjects_dir=subjects_dir, image_format="png")
522+
report.add_forward(
523+
forward=fwd_fname,
524+
subject="sample",
525+
subjects_dir=subjects_dir,
526+
title="Forward solution",
527+
)
528+
assert len(report.html) == 4
529+
530+
report = Report(subjects_dir=subjects_dir, image_format="png")
531+
report.add_forward(
532+
forward=fwd_fname,
533+
subjects_dir=subjects_dir,
534+
title="Forward solution",
535+
)
536+
assert len(report.html) == 1
537+
538+
517539
@testing.requires_testing_data
518540
def test_render_mri_without_bem(tmp_path):
519541
"""Test rendering MRI without BEM for mne report."""
@@ -882,6 +904,7 @@ def test_survive_pickle(tmp_path):
882904

883905
@pytest.mark.slowtest # ~30 s on Azure Windows
884906
@testing.requires_testing_data
907+
@pytest.mark.filterwarnings("ignore:Distances could not be calculated.*:RuntimeWarning")
885908
def test_manual_report_2d(tmp_path, invisible_fig):
886909
"""Simulate user manually creating report by adding one file at a time."""
887910
pytest.importorskip("sklearn")

mne/viz/misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ def plot_bem(
631631
632632
.. versionchanged:: 0.20
633633
All sources are shown on the nearest slice rather than some
634+
being omitted.
634635
%(trans)s
635636
.. versionadded:: 1.9
636637
show : bool

0 commit comments

Comments
 (0)