Skip to content

Commit db4163c

Browse files
committed
Improve rank test skips
1 parent aa6cd9b commit db4163c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pandas/tests/series/methods/test_rank.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,20 +273,20 @@ def test_rank_signature(self):
273273
with pytest.raises(ValueError, match=msg):
274274
s.rank("average")
275275

276-
def test_rank_tie_methods(self, ser, results, dtype, using_infer_string):
276+
def test_rank_tie_methods(
277+
self, ser, results, dtype, using_infer_string, using_nan_is_na
278+
):
277279
method, exp = results
278280
if (
279281
dtype == "int64"
280-
or dtype == "int64[pyarrow]"
281-
or dtype == "uint64[pyarrow]"
282-
or dtype == "float64[pyarrow]"
282+
or (dtype in ["int64[pyarrow]", "uint64[pyarrow]"] and not using_nan_is_na)
283283
or (not using_infer_string and dtype == "str")
284284
):
285285
pytest.skip("int64/str does not support NaN")
286286

287287
ser = ser if dtype is None else ser.astype(dtype)
288288
result = ser.rank(method=method)
289-
if dtype == "float64[pyarrow]":
289+
if dtype == "float64[pyarrow]" and not using_nan_is_na:
290290
# the NaNs are not treated as NA
291291
exp = exp.copy()
292292
if method == "average":
@@ -418,11 +418,13 @@ def test_rank_dense_method(self, dtype, ser, exp):
418418
expected = Series(exp).astype(expected_dtype(dtype, "dense"))
419419
tm.assert_series_equal(result, expected)
420420

421-
def test_rank_descending(self, ser, results, dtype, using_infer_string):
421+
def test_rank_descending(
422+
self, ser, results, dtype, using_infer_string, using_nan_is_na
423+
):
422424
method, _ = results
423425
if (
424426
dtype == "int64"
425-
or dtype == "int64[pyarrow]"
427+
or (dtype in ["int64[pyarrow]"] and not using_nan_is_na)
426428
or (not using_infer_string and dtype == "str")
427429
):
428430
s = ser.dropna().astype(dtype)

0 commit comments

Comments
 (0)