Skip to content

Commit f464618

Browse files
DimitriPapadopouloseffigies
authored andcommitted
STY: Apply ruff/flake8-pytest-style rule PT006
PT006 Wrong type passed to first argument of `@pytest.mark.parametrize`; expected `tuple`
1 parent 2532132 commit f464618

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

nibabel/cmdline/tests/test_convert.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_convert_dtype(tmp_path, data_dtype):
7171

7272

7373
@pytest.mark.parametrize(
74-
'ext,img_class',
74+
('ext', 'img_class'),
7575
[
7676
('mgh', nib.MGHImage),
7777
('img', nib.Nifti1Pair),
@@ -94,7 +94,7 @@ def test_convert_by_extension(tmp_path, ext, img_class):
9494

9595

9696
@pytest.mark.parametrize(
97-
'ext,img_class',
97+
('ext', 'img_class'),
9898
[
9999
('mgh', nib.MGHImage),
100100
('img', nib.Nifti1Pair),
@@ -141,7 +141,7 @@ def test_convert_nifti_int_fail(tmp_path):
141141

142142

143143
@pytest.mark.parametrize(
144-
'orig_dtype,alias,expected_dtype',
144+
('orig_dtype', 'alias', 'expected_dtype'),
145145
[
146146
('int64', 'mask', 'uint8'),
147147
('int64', 'compat', 'int32'),

nibabel/cmdline/tests/test_roi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_nib_roi(tmp_path, inplace):
119119

120120

121121
@pytest.mark.parametrize(
122-
'args, errmsg',
122+
('args', 'errmsg'),
123123
(
124124
(('-i', '1:1'), 'Cannot take zero-length slice'),
125125
(('-j', '1::2'), 'Downsampling is not supported'),

nibabel/tests/test_euler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def test_euler_mat_1():
123123
assert_array_equal(M, np.eye(3))
124124

125125

126-
@pytest.mark.parametrize('x, y, z', eg_rots)
126+
@pytest.mark.parametrize(('x', 'y', 'z'), eg_rots)
127127
def test_euler_mat_2(x, y, z):
128128
M1 = nea.euler2mat(z, y, x)
129129
M2 = sympy_euler(z, y, x)
@@ -176,7 +176,7 @@ def test_euler_instability():
176176
assert not np.allclose(M_e, M_e_back)
177177

178178

179-
@pytest.mark.parametrize('x, y, z', eg_rots)
179+
@pytest.mark.parametrize(('x', 'y', 'z'), eg_rots)
180180
def test_quats(x, y, z):
181181
M1 = nea.euler2mat(z, y, x)
182182
quatM = nq.mat2quat(M1)

nibabel/tests/test_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
@pytest.mark.parametrize(
16-
'verbose, v_args', [(-2, ['-qq']), (-1, ['-q']), (0, []), (1, ['-v']), (2, ['-vv'])]
16+
('verbose', 'v_args'), [(-2, ['-qq']), (-1, ['-q']), (0, []), (1, ['-v']), (2, ['-vv'])]
1717
)
1818
@pytest.mark.parametrize('doctests', (True, False))
1919
@pytest.mark.parametrize('coverage', (True, False))

nibabel/tests/test_pkg_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_cmp_pkg_version_0():
3737

3838

3939
@pytest.mark.parametrize(
40-
'test_ver, pkg_ver, exp_out',
40+
('test_ver', 'pkg_ver', 'exp_out'),
4141
[
4242
('1.0', '1.0', 0),
4343
('1.0.0', '1.0', 0),

nibabel/tests/test_quaternions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def test_inverse_0():
146146
assert iq.dtype.kind == 'f'
147147

148148

149-
@pytest.mark.parametrize('M, q', eg_pairs)
149+
@pytest.mark.parametrize(('M', 'q'), eg_pairs)
150150
def test_inverse_1(M, q):
151151
iq = nq.inverse(q)
152152
iqM = nq.quat2mat(iq)
@@ -169,15 +169,15 @@ def test_norm():
169169
assert not nq.isunit(qi)
170170

171171

172-
@pytest.mark.parametrize('M1, q1', eg_pairs[0::4])
173-
@pytest.mark.parametrize('M2, q2', eg_pairs[1::4])
172+
@pytest.mark.parametrize(('M1', 'q1'), eg_pairs[0::4])
173+
@pytest.mark.parametrize(('M2', 'q2'), eg_pairs[1::4])
174174
def test_mult(M1, q1, M2, q2):
175175
# Test that quaternion * same as matrix *
176176
q21 = nq.mult(q2, q1)
177177
assert_array_almost_equal, M2 @ M1, nq.quat2mat(q21)
178178

179179

180-
@pytest.mark.parametrize('M, q', eg_pairs)
180+
@pytest.mark.parametrize(('M', 'q'), eg_pairs)
181181
def test_inverse(M, q):
182182
iq = nq.inverse(q)
183183
iqM = nq.quat2mat(iq)
@@ -186,7 +186,7 @@ def test_inverse(M, q):
186186

187187

188188
@pytest.mark.parametrize('vec', np.eye(3))
189-
@pytest.mark.parametrize('M, q', eg_pairs)
189+
@pytest.mark.parametrize(('M', 'q'), eg_pairs)
190190
def test_qrotate(vec, M, q):
191191
vdash = nq.rotate_vector(vec, q)
192192
vM = M @ vec

nibabel/tests/test_scaling.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
@pytest.mark.parametrize(
28-
'in_arr, res',
28+
('in_arr', 'res'),
2929
[
3030
([[-1, 0, 1], [np.inf, np.nan, -np.inf]], (-1, 1)),
3131
(np.array([[-1, 0, 1], [np.inf, np.nan, -np.inf]]), (-1, 1)),
@@ -134,7 +134,7 @@ def test_a2f_nan2zero():
134134

135135

136136
@pytest.mark.parametrize(
137-
'in_type, out_type',
137+
('in_type', 'out_type'),
138138
[
139139
(np.int16, np.int16),
140140
(np.int16, np.int8),
@@ -163,7 +163,7 @@ def test_array_file_scales(in_type, out_type):
163163

164164

165165
@pytest.mark.parametrize(
166-
'category0, category1, overflow',
166+
('category0', 'category1', 'overflow'),
167167
[
168168
# Confirm that, for all ints and uints as input, and all possible outputs,
169169
# for any simple way of doing the calculation, the result is near enough

nibabel/tests/test_spaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def test_slice2volume():
125125

126126

127127
@pytest.mark.parametrize(
128-
'index, axis',
128+
('index', 'axis'),
129129
[
130130
[-1, 0],
131131
[0, -1],

nibabel/tests/test_testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def f():
148148

149149

150150
@pytest.mark.parametrize(
151-
'regex, entries',
151+
('regex', 'entries'),
152152
[
153153
['.*', ''],
154154
['.*', ['any']],

0 commit comments

Comments
 (0)