Skip to content

Commit fa5f920

Browse files
committed
TEST: Simplify and comment test_data tests
1 parent 7a35fc9 commit fa5f920

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nibabel/tests/test_testing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ def test_assert_re_in(regex, entries):
171171

172172

173173
def test_test_data():
174-
assert str(test_data()) == str(data_path)
174+
assert str(test_data()) == str(data_path) # Always get the same result
175+
# Works the same as using __file__ and os.path utilities
175176
assert str(test_data()) == os.path.abspath(
176177
os.path.join(os.path.dirname(__file__), '..', 'tests', 'data')
177178
)
179+
# Check action of subdir and that existence checks work
178180
for subdir in ('nicom', 'gifti', 'externals'):
179-
assert str(test_data(subdir)) == os.path.join(
180-
data_path.parent.parent, subdir, 'tests', 'data'
181-
)
181+
assert test_data(subdir) == data_path.parent.parent / subdir / 'tests' / 'data'
182182
assert os.path.exists(test_data(subdir))
183183
assert not os.path.exists(test_data(subdir, 'doesnotexist'))
184184

0 commit comments

Comments
 (0)