Skip to content

Commit

Permalink
add some teeth to the test
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock committed Jan 30, 2025
1 parent 5f18803 commit a32ec66
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mne_bids_pipeline/tests/test_run.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Download test data and run a test suite."""

import os
import re
import shutil
import sys
from collections.abc import Collection
Expand All @@ -9,6 +10,7 @@
from typing import Any, TypedDict

import pytest
from h5io import read_hdf5
from mne_bids import BIDSPath, get_bids_path_from_fname

from mne_bids_pipeline._config_import import _import_config
Expand Down Expand Up @@ -382,3 +384,29 @@ def test_session_specific_mri(
with capsys.disabled():
print()
main()
# check some things that are indicative of different MRIs being used in each session
results = list()
for sess in ("a", "b"):
fname = (
new_bids_path.root
/ "derivatives"
/ "mne-bids-pipeline"
/ "MNE-funloc-data"
/ "sub-01"
/ f"ses-{sess}"
/ "meg"
/ f"sub-01_ses-{sess}_task-funloc_report.h5"
)
report = read_hdf5(fname, title="mnepython")
coregs = next(
filter(lambda x: x["dom_id"] == "Sensor_alignment", report["_content"])
)
pattern = re.compile(
r"Average distance from (?P<npts>\d+) digitized points to head: "
r"(?P<dist>\d+(?:\.\d+)?) mm"
)
result = pattern.search(coregs["html"])
assert result is not None
assert float(result.group("dist")) < 3
results.append(result.groups())
assert results[0] != results[1] # different npts and/or different mean distance

0 comments on commit a32ec66

Please sign in to comment.