Skip to content

Commit 5bc2617

Browse files
committed
Improve rank test skips
1 parent ce36571 commit 5bc2617

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

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

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

410-
def test_rank_descending(self, ser, results, dtype, using_infer_string):
410+
def test_rank_descending(
411+
self, ser, results, dtype, using_infer_string, using_nan_is_na
412+
):
411413
method, _ = results
412414
if (
413415
dtype == "int64"
414-
or dtype == "int64[pyarrow]"
416+
or (dtype in ["int64[pyarrow]"] and not using_nan_is_na)
415417
or (not using_infer_string and dtype == "str")
416418
):
417419
s = ser.dropna().astype(dtype)

0 commit comments

Comments
 (0)