Skip to content

Commit be5b9f3

Browse files
committed
Improve rank test skips
1 parent f1dbccd commit be5b9f3

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
@@ -268,20 +268,20 @@ def test_rank_signature(self):
268268
with pytest.raises(ValueError, match=msg):
269269
s.rank("average")
270270

271-
def test_rank_tie_methods(self, ser, results, dtype, using_infer_string):
271+
def test_rank_tie_methods(
272+
self, ser, results, dtype, using_infer_string, using_nan_is_na
273+
):
272274
method, exp = results
273275
if (
274276
dtype == "int64"
275-
or dtype == "int64[pyarrow]"
276-
or dtype == "uint64[pyarrow]"
277-
or dtype == "float64[pyarrow]"
277+
or (dtype in ["int64[pyarrow]", "uint64[pyarrow]"] and not using_nan_is_na)
278278
or (not using_infer_string and dtype == "str")
279279
):
280280
pytest.skip("int64/str does not support NaN")
281281

282282
ser = ser if dtype is None else ser.astype(dtype)
283283
result = ser.rank(method=method)
284-
if dtype == "float64[pyarrow]":
284+
if dtype == "float64[pyarrow]" and not using_nan_is_na:
285285
# the NaNs are not treated as NA
286286
exp = exp.copy()
287287
if method == "average":
@@ -406,11 +406,13 @@ def test_rank_dense_method(self, dtype, ser, exp):
406406
expected = Series(exp).astype(expected_dtype(dtype, "dense"))
407407
tm.assert_series_equal(result, expected)
408408

409-
def test_rank_descending(self, ser, results, dtype, using_infer_string):
409+
def test_rank_descending(
410+
self, ser, results, dtype, using_infer_string, using_nan_is_na
411+
):
410412
method, _ = results
411413
if (
412414
dtype == "int64"
413-
or dtype == "int64[pyarrow]"
415+
or (dtype in ["int64[pyarrow]"] and not using_nan_is_na)
414416
or (not using_infer_string and dtype == "str")
415417
):
416418
s = ser.dropna().astype(dtype)

0 commit comments

Comments
 (0)