Skip to content

Commit 9a2a8de

Browse files
author
Ben Cipollini
committed
Simplify idioms, delete unnecessary 'global' definition.
1 parent ad87eaf commit 9a2a8de

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

nibabel/tests/data/check_parrec_reslice.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434

3535
def resample_img2img(img_to, img_from, order=1, out_class=nib.Nifti1Image):
36-
global have_scipy
3736
if not have_scipy:
3837
raise Exception('Scipy must be installed to run resample_img2img.')
3938

nibabel/tests/test_helpers.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
from io import BytesIO
44

55
import numpy as np
6-
from nose.tools import assert_true
7-
from numpy.testing import assert_array_equal
86

97
from ..openers import Opener
10-
from ..optpkg import optional_package
118
from ..tmpdirs import InTemporaryDirectory
12-
_, have_scipy, _ = optional_package('scipy')
9+
from ..optpkg import optional_package
10+
_, have_scipy, _ = optional_package('scipy.io')
11+
12+
from nose.tools import assert_true
13+
from numpy.testing import assert_array_equal
1314

1415

1516
def bytesio_filemap(klass):
@@ -45,14 +46,16 @@ def bz2_mio_error():
4546
"""
4647
if not have_scipy:
4748
return True
49+
import scipy.io
50+
4851
with InTemporaryDirectory():
4952
with Opener('test.mat.bz2', 'wb') as fobj:
5053
try:
51-
import scipy.io
5254
scipy.io.savemat(fobj, {'a': 1}, format='4')
5355
except ValueError:
5456
return True
55-
return False
57+
else:
58+
return False
5659

5760

5861
def assert_data_similar(arr, params):

0 commit comments

Comments
 (0)