Skip to content

Commit 91ba263

Browse files
simonjayhawkinsPingviinituutti
authored andcommitted
TST/CLN: follow-up to pandas-dev#24750 (pandas-dev#24810)
1 parent 904e737 commit 91ba263

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

pandas/tests/series/indexing/test_boolean.py

+11-17
Original file line numberDiff line numberDiff line change
@@ -160,28 +160,22 @@ def test_where_unsafe_float(float_dtype):
160160
assert_series_equal(s, expected)
161161

162162

163-
@pytest.mark.parametrize("dtype", [np.int64, np.float64])
164-
def test_where_unsafe_upcast(dtype):
165-
s = Series(np.arange(10), dtype=dtype)
166-
values = [2.5, 3.5, 4.5, 5.5, 6.5]
167-
168-
mask = s < 5
169-
expected = Series(values + lrange(5, 10), dtype="float64")
170-
171-
s[mask] = values
172-
assert_series_equal(s, expected)
173-
174-
175-
@pytest.mark.parametrize("dtype", [
176-
np.int8, np.int16, np.int32, np.float32
163+
@pytest.mark.parametrize("dtype,expected_dtype", [
164+
(np.int8, np.float64),
165+
(np.int16, np.float64),
166+
(np.int32, np.float64),
167+
(np.int64, np.float64),
168+
(np.float32, np.float32),
169+
(np.float64, np.float64)
177170
])
178-
def test_where_upcast(dtype):
171+
def test_where_unsafe_upcast(dtype, expected_dtype):
179172
# see gh-9743
180173
s = Series(np.arange(10), dtype=dtype)
181-
mask = s < 5
182-
183174
values = [2.5, 3.5, 4.5, 5.5, 6.5]
175+
mask = s < 5
176+
expected = Series(values + lrange(5, 10), dtype=expected_dtype)
184177
s[mask] = values
178+
assert_series_equal(s, expected)
185179

186180

187181
def test_where_unsafe():

0 commit comments

Comments
 (0)