Skip to content

Commit

Permalink
Backport PR pandas-dev#57892 on branch 2.2.x (CI: xfail Pyarrow slici…
Browse files Browse the repository at this point in the history
…ng test) (pandas-dev#57898)

Backport PR pandas-dev#57892: CI: xfail Pyarrow slicing test

Co-authored-by: Matthew Roeschke <[email protected]>
  • Loading branch information
meeseeksmachine and mroeschke authored Mar 18, 2024
1 parent cd6eeae commit 71a6797
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
pa_version_under13p0,
pa_version_under14p0,
pa_version_under14p1,
pa_version_under16p0,
)

if TYPE_CHECKING:
Expand Down Expand Up @@ -186,6 +187,7 @@ def get_bz2_file() -> type[pandas.compat.compressors.BZ2File]:
"pa_version_under13p0",
"pa_version_under14p0",
"pa_version_under14p1",
"pa_version_under16p0",
"IS64",
"ISMUSL",
"PY310",
Expand Down
2 changes: 2 additions & 0 deletions pandas/compat/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
pa_version_under14p0 = _palv < Version("14.0.0")
pa_version_under14p1 = _palv < Version("14.0.1")
pa_version_under15p0 = _palv < Version("15.0.0")
pa_version_under16p0 = _palv < Version("16.0.0")
except ImportError:
pa_version_under10p1 = True
pa_version_under11p0 = True
Expand All @@ -23,3 +24,4 @@
pa_version_under14p0 = True
pa_version_under14p1 = True
pa_version_under15p0 = True
pa_version_under16p0 = True
12 changes: 11 additions & 1 deletion pandas/tests/indexes/object/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
NA,
is_matching_na,
)
from pandas.compat import pa_version_under16p0
import pandas.util._test_decorators as td

import pandas as pd
Expand Down Expand Up @@ -200,7 +201,16 @@ class TestSliceLocs:
(pd.IndexSlice["m":"m":-1], ""), # type: ignore[misc]
],
)
def test_slice_locs_negative_step(self, in_slice, expected, dtype):
def test_slice_locs_negative_step(self, in_slice, expected, dtype, request):
if (
not pa_version_under16p0
and dtype == "string[pyarrow_numpy]"
and in_slice == slice("a", "a", -1)
):
request.applymarker(
pytest.mark.xfail(reason="https://github.com/apache/arrow/issues/40642")
)

index = Index(list("bcdxy"), dtype=dtype)

s_start, s_stop = index.slice_locs(in_slice.start, in_slice.stop, in_slice.step)
Expand Down

0 comments on commit 71a6797

Please sign in to comment.