Skip to content

Commit 9d9b56e

Browse files
author
Chris Gorgolewski
committed
fixed spacing, take 27
1 parent d6aa52d commit 9d9b56e

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

nibabel/tests/test_volumeutils.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ def test_working_type():
792792
# need this because of the very confusing np.int32 != np.intp (on 32 bit).
793793
def wt(*args, **kwargs):
794794
return np.dtype(working_type(*args, **kwargs)).str
795-
d1=np.atleast_1d
795+
d1 = np.atleast_1d
796796
for in_type in NUMERIC_TYPES:
797797
in_ts = np.dtype(in_type).str
798798
assert wt(in_type) == in_ts
@@ -812,7 +812,7 @@ def wt(*args, **kwargs):
812812
out_val = in_val - d1(i_val)
813813
assert wt(in_type, 1, i_val) == out_val.dtype.str
814814
# Combine scaling and intercept
815-
out_val=(in_val - d1(i_val)) / d1(sl_val)
815+
out_val = (in_val - d1(i_val)) / d1(sl_val)
816816
assert wt(in_type, sl_val, i_val) == out_val.dtype.str
817817
# Confirm that type codes and dtypes work as well
818818
f32s = np.dtype(np.float32).str
@@ -849,7 +849,7 @@ def test_best_write_scale_ftype():
849849
assert best_write_scale_ftype(arr, np.float32(2), 0) == better_float_of(dtt, np.float32)
850850
assert best_write_scale_ftype(arr, 1, np.float32(1)) == better_float_of(dtt, np.float32)
851851
# Overflowing ints with scaling results in upcast
852-
best_vals=((np.float32, np.float64),)
852+
best_vals = ((np.float32, np.float64),)
853853
if np.longdouble in OK_FLOATS:
854854
best_vals += ((np.float64, np.longdouble),)
855855
for lower_t, higher_t in best_vals:
@@ -869,14 +869,14 @@ def test_best_write_scale_ftype():
869869
assert best_write_scale_ftype(arr, 1, -big_delta / 2.01) == lower_t
870870
assert best_write_scale_ftype(arr, 1, -big_delta / 2.0) == higher_t
871871
# With infs already in input, default type returns
872-
arr[0]=np.inf
872+
arr[0] = np.inf
873873
assert best_write_scale_ftype(arr, lower_t(0.5), 0) == lower_t
874-
arr[0]=-np.inf
874+
arr[0] = -np.inf
875875
assert best_write_scale_ftype(arr, lower_t(0.5), 0) == lower_t
876876

877877

878878
def test_can_cast():
879-
tests=((np.float32, np.float32, True, True, True),
879+
tests = ((np.float32, np.float32, True, True, True),
880880
(np.float64, np.float32, True, True, True),
881881
(np.complex128, np.float32, False, False, False),
882882
(np.float32, np.complex128, True, True, True),
@@ -1060,8 +1060,8 @@ def test_allopen_compresslevel():
10601060
with open(__file__, 'rb') as fobj:
10611061
my_self=fobj.read()
10621062
# Prepare loop
1063-
fname='test.gz'
1064-
sizes={}
1063+
fname = 'test.gz'
1064+
sizes = {}
10651065
# Stash module global
10661066
from .. import volumeutils as vu
10671067
original_compress_level = vu.default_compresslevel
@@ -1085,8 +1085,8 @@ def test_allopen_compresslevel():
10851085

10861086

10871087
def test_shape_zoom_affine():
1088-
shape=(3, 5, 7)
1089-
zooms=(3, 2, 1)
1088+
shape = (3, 5, 7)
1089+
zooms = (3, 2, 1)
10901090
res = shape_zoom_affine(shape, zooms)
10911091
exp = np.array([[-3., 0., 0., 3.],
10921092
[0., 2., 0., -4.],
@@ -1121,7 +1121,7 @@ def test_dtypes():
11211121
# In [10]: dtype('<f4') == dtype('<f4').newbyteorder('<')
11221122
# Out[10]: True
11231123
# where '<' is the native byte order
1124-
dt_defs=((16, 'float32', np.float32),)
1124+
dt_defs = ((16, 'float32', np.float32),)
11251125
dtr = make_dt_codes(dt_defs)
11261126
# check we have the fields we were expecting
11271127
assert dtr.value_set() == set((16,))
@@ -1136,23 +1136,23 @@ def test_dtypes():
11361136
# But this one used to fail
11371137
assert dtr[np.dtype('f4').newbyteorder(native_code)] == 16
11381138
# Check we can pass in niistring as well
1139-
dt_defs=((16, 'float32', np.float32, 'ASTRING'),)
1139+
dt_defs = ((16, 'float32', np.float32, 'ASTRING'),)
11401140
dtr = make_dt_codes(dt_defs)
11411141
assert dtr[np.dtype('f4').newbyteorder('S')] == 16
11421142
assert dtr.value_set() == set((16,))
11431143
assert dtr.fields == ('code', 'label', 'type', 'niistring', 'dtype',
11441144
'sw_dtype')
11451145
assert dtr.niistring[16] == 'ASTRING'
11461146
# And that unequal elements raises error
1147-
dt_defs=((16, 'float32', np.float32, 'ASTRING'),
1147+
dt_defs = ((16, 'float32', np.float32, 'ASTRING'),
11481148
(16, 'float32', np.float32))
11491149
with pytest.raises(ValueError):
11501150
make_dt_codes(dt_defs)
11511151
# And that 2 or 5 elements raises error
1152-
dt_defs=((16, 'float32'),)
1152+
dt_defs = ((16, 'float32'),)
11531153
with pytest.raises(ValueError):
11541154
make_dt_codes(dt_defs)
1155-
dt_defs=((16, 'float32', np.float32, 'ASTRING', 'ANOTHERSTRING'),)
1155+
dt_defs = ((16, 'float32', np.float32, 'ASTRING', 'ANOTHERSTRING'),)
11561156
with pytest.raises(ValueError):
11571157
make_dt_codes(dt_defs)
11581158

@@ -1185,7 +1185,7 @@ def assert_rt(data,
11851185
order=order)
11861186
expected = to_write.copy()
11871187
if have_nans and not nan_fill is None:
1188-
expected[nan_positions]=nan_fill * slope + inter
1188+
expected[nan_positions] = nan_fill * slope + inter
11891189
assert_array_equal(arr * slope + inter, expected)
11901190
assert_array_equal(to_write, backup)
11911191

@@ -1214,7 +1214,7 @@ def assert_rt(data,
12141214
nan_fill=nan_fill)
12151215
# Check defense against in-place modification with nans present
12161216
if not nan_fill is None:
1217-
data[1]=np.nan
1217+
data[1] = np.nan
12181218
assert_rt(data, shape, np.int16,
12191219
in_cast=in_cast,
12201220
pre_clips=pre_clips,
@@ -1226,7 +1226,7 @@ def assert_rt(data,
12261226

12271227
def test_array_from_file_overflow():
12281228
# Test for int overflow in size calculation in array_from_file
1229-
shape=(1500,) * 6
1229+
shape = (1500,) * 6
12301230

12311231
class NoStringIO: # Null file-like for forcing error
12321232

@@ -1263,7 +1263,7 @@ def run(self):
12631263
with warnings.catch_warnings():
12641264
go.set()
12651265
while not stop.is_set():
1266-
warnings.filters[:]=[]
1266+
warnings.filters[:] = []
12671267
time.sleep(0)
12681268

12691269
class CheckScaling(threading.Thread):

0 commit comments

Comments
 (0)