Skip to content

Commit f3be7b2

Browse files
committed
TEST: Simplify, reformat test_data
1 parent 5f695b8 commit f3be7b2

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

nibabel/tests/test_data.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ def test_data_path(with_nimd_env):
157157
with open(tmpfile, 'wt') as fobj:
158158
fobj.write('[DATA]\n')
159159
fobj.write('path = %s\n' % '/path/two')
160-
assert (get_data_path() ==
161-
tst_list + ['/path/two'] + old_pth)
160+
assert get_data_path() == tst_list + ['/path/two'] + old_pth
162161

163162

164163
def test_find_data_dir():
@@ -201,10 +200,10 @@ def test_make_datasource(with_nimd_env):
201200
assert ds.version == '0.1'
202201

203202

203+
@pytest.mark.xfail(raises=DataError)
204204
def test_bomber():
205-
with pytest.raises(DataError):
206-
b = Bomber('bomber example', 'a message')
207-
b.any_attribute # no error
205+
b = Bomber('bomber example', 'a message')
206+
b.any_attribute # no error
208207

209208

210209
def test_bomber_inspect():
@@ -213,13 +212,12 @@ def test_bomber_inspect():
213212

214213

215214
def test_datasource_or_bomber(with_nimd_env):
216-
pkg_def = dict(
217-
relpath='pkg')
215+
pkg_def = dict(relpath='pkg')
218216
with TemporaryDirectory() as tmpdir:
219217
nibd.get_data_path = lambda: [tmpdir]
220218
ds = datasource_or_bomber(pkg_def)
221219
with pytest.raises(DataError):
222-
getattr(ds, 'get_filename')
220+
ds.get_filename('some_file.txt')
223221
pkg_dir = pjoin(tmpdir, 'pkg')
224222
os.mkdir(pkg_dir)
225223
tmpfile = pjoin(pkg_dir, 'config.ini')
@@ -235,4 +233,4 @@ def test_datasource_or_bomber(with_nimd_env):
235233
pkg_def['min version'] = '0.3'
236234
ds = datasource_or_bomber(pkg_def) # not OK
237235
with pytest.raises(DataError):
238-
getattr(ds, 'get_filename')
236+
ds.get_filename('some_file.txt')

0 commit comments

Comments
 (0)