Skip to content

Commit 94d38d4

Browse files
committed
Add test
1 parent f36245f commit 94d38d4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

mne_bids/tests/test_path.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,3 +1648,22 @@ def test_dont_create_dirs_on_fpath_access(tmp_path):
16481648
bp = BIDSPath(subject="01", datatype="eeg", root=tmp_path)
16491649
bp.fpath # accessing .fpath is required for this regression test
16501650
assert not (tmp_path / "sub-01").exists()
1651+
1652+
1653+
def test_fpath_common_prefix(tmp_path):
1654+
sub_dir = tmp_path / "sub-1" / "eeg"
1655+
sub_dir.mkdir(exist_ok=True, parents=True)
1656+
(sub_dir / "sub-1_run-1_raw.fif").touch()
1657+
(sub_dir / "sub-1_run-2.edf").touch()
1658+
# Other valid BIDS paths with the same basename prefix:
1659+
(sub_dir / "sub-1_run-10_raw.fif").touch()
1660+
(sub_dir / "sub-1_run-20.edf").touch()
1661+
1662+
assert (
1663+
BIDSPath(root=tmp_path, subject="1", run="1").fpath
1664+
== sub_dir / "sub-1_run-1_raw.fif"
1665+
)
1666+
assert (
1667+
BIDSPath(root=tmp_path, subject="1", run="2").fpath
1668+
== sub_dir / "sub-1_run-2.edf"
1669+
)

0 commit comments

Comments
 (0)