Skip to content

Commit b62f4ec

Browse files
committed
more
1 parent ea850f8 commit b62f4ec

File tree

4 files changed

+63
-63
lines changed

4 files changed

+63
-63
lines changed

mne_bids/commands/tests/test_cli.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def test_raw_to_bids(tmp_path):
9595
mne_bids_raw_to_bids.run()
9696

9797
# Test EDF files as well
98-
edf_data_path = op.join(base_path, "edf", "tests", "data")
99-
edf_fname = op.join(edf_data_path, "test.edf")
98+
edf_data_path = base_path / "edf" / "tests" / "data"
99+
edf_fname = edf_data_path / "test.edf"
100100
with ArgvSetter(
101101
(
102102
"--subject_id",
@@ -125,9 +125,9 @@ def test_raw_to_bids(tmp_path):
125125
def test_cp(tmp_path):
126126
"""Test mne_bids cp."""
127127
output_path = str(tmp_path)
128-
data_path = op.join(base_path, "brainvision", "tests", "data")
129-
raw_fname = op.join(data_path, "test.vhdr")
130-
outname = op.join(output_path, "test2.vhdr")
128+
data_path = base_path / "brainvision" / "tests" / "data"
129+
raw_fname = data_path / "test.vhdr"
130+
outname = output_path / "test2.vhdr"
131131

132132
# Check that help is printed
133133
check_usage(mne_bids_cp)

mne_bids/tests/test_copyfiles.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
@testing.requires_testing_data
3131
def test_get_brainvision_encoding():
3232
"""Test getting the file-encoding from a BrainVision header."""
33-
data_path = op.join(base_path, "brainvision", "tests", "data")
34-
raw_fname = op.join(data_path, "test.vhdr")
33+
data_path = base_path / "brainvision" / "tests" / "data"
34+
raw_fname = data_path / "test.vhdr"
3535

3636
with pytest.raises(UnicodeDecodeError):
3737
with open(raw_fname, encoding="ascii") as f:
@@ -44,11 +44,11 @@ def test_get_brainvision_encoding():
4444

4545
def test_get_brainvision_paths(tmp_path):
4646
"""Test getting the file links from a BrainVision header."""
47-
data_path = op.join(base_path, "brainvision", "tests", "data")
48-
raw_fname = op.join(data_path, "test.vhdr")
47+
data_path = base_path / "brainvision" / "tests" / "data"
48+
raw_fname = data_path / "test.vhdr"
4949

5050
with pytest.raises(ValueError):
51-
_get_brainvision_paths(op.join(data_path, "test.eeg"))
51+
_get_brainvision_paths(data_path / "test.eeg")
5252

5353
# Write some temporary test files
5454
with open(tmp_path / "test1.vhdr", "w") as f:
@@ -76,10 +76,10 @@ def test_get_brainvision_paths(tmp_path):
7676
)
7777
def test_copyfile_brainvision(tmp_path):
7878
"""Test the copying of BrainVision vhdr, vmrk and eeg files."""
79-
bids_root = str(tmp_path)
80-
data_path = op.join(base_path, "brainvision", "tests", "data")
81-
raw_fname = op.join(data_path, "test.vhdr")
82-
new_name = op.join(bids_root, "tested_conversion.vhdr")
79+
bids_root = tmp_path
80+
data_path = base_path / "brainvision" / "tests" / "data"
81+
raw_fname = data_path / "test.vhdr"
82+
new_name = bids_root / "tested_conversion.vhdr"
8383

8484
# IO error testing
8585
with pytest.raises(ValueError, match="Need to move data with same"):
@@ -112,18 +112,18 @@ def test_copyfile_edf(tmp_path):
112112
"""Test the anonymization of EDF/BDF files."""
113113
bids_root = tmp_path / "bids1"
114114
bids_root.mkdir()
115-
data_path = op.join(base_path, "edf", "tests", "data")
115+
data_path = base_path / "edf" / "tests" / "data"
116116

117117
# Test regular copying
118118
for ext in [".edf", ".bdf"]:
119-
raw_fname = op.join(data_path, "test" + ext)
120-
new_name = op.join(bids_root, "test_copy" + ext)
119+
raw_fname = data_path / f"test{ext}"
120+
new_name = bids_root / f"test_copy{ext}"
121121
copyfile_edf(raw_fname, new_name)
122122

123123
# IO error testing
124124
with pytest.raises(ValueError, match="Need to move data with same"):
125-
raw_fname = op.join(data_path, "test.edf")
126-
new_name = op.join(bids_root, "test_copy.bdf")
125+
raw_fname = data_path / "test.edf"
126+
new_name = bids_root / "test_copy.bdf"
127127
copyfile_edf(raw_fname, new_name)
128128

129129
# Add some subject info to an EDF to test anonymization
@@ -184,7 +184,7 @@ def test_copyfile_edfbdf_uppercase(tmp_path):
184184
"""Test the copying of EDF/BDF files with upper-case extension."""
185185
bids_root = tmp_path / "bids1"
186186
bids_root.mkdir()
187-
data_path = op.join(base_path, "edf", "tests", "data")
187+
data_path = base_path / "edf" / "tests" / "data"
188188

189189
# Test regular copying
190190
for ext in [".edf", ".bdf"]:
@@ -226,7 +226,7 @@ def test_copyfile_eeglab(tmp_path, fname):
226226
def test_copyfile_kit(tmp_path):
227227
"""Test copying and renaming KIT files to a new location."""
228228
output_path = str(tmp_path)
229-
data_path = op.join(base_path, "kit", "tests", "data")
229+
data_path = base_path / "kit" / "tests" / "data"
230230
raw_fname = op.join(data_path, "test.sqd")
231231
hpi_fname = op.join(data_path, "test_mrk.sqd")
232232
electrode_fname = op.join(data_path, "test.elp")

mne_bids/tests/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_age_on_date():
149149
def test_infer_eeg_placement_scheme():
150150
"""Test inferring a correct EEG placement scheme."""
151151
# no eeg channels case (e.g., MEG data)
152-
data_path = op.join(base_path, "bti", "tests", "data")
152+
data_path = base_path / "bti" / "tests" / "data"
153153
raw_fname = op.join(data_path, "test_pdf_linux")
154154
config_fname = op.join(data_path, "test_config_linux")
155155
headshape_fname = op.join(data_path, "test_hs_linux")
@@ -158,7 +158,7 @@ def test_infer_eeg_placement_scheme():
158158
assert placement_scheme == "n/a"
159159

160160
# 1020 case
161-
data_path = op.join(base_path, "brainvision", "tests", "data")
161+
data_path = base_path / "brainvision" / "tests" / "data"
162162
raw_fname = op.join(data_path, "test.vhdr")
163163
raw = mne.io.read_raw_brainvision(raw_fname)
164164
placement_scheme = _infer_eeg_placement_scheme(raw)

0 commit comments

Comments
 (0)