From 66667f6193e284df819ca65e9664dd0b47f37b8c Mon Sep 17 00:00:00 2001 From: Brock Date: Tue, 20 Aug 2024 14:49:18 -0700 Subject: [PATCH] xfail on old pyarrow --- pandas/tests/strings/test_find_replace.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pandas/tests/strings/test_find_replace.py b/pandas/tests/strings/test_find_replace.py index 00677ef4fcfe9c..65d6963ae53995 100644 --- a/pandas/tests/strings/test_find_replace.py +++ b/pandas/tests/strings/test_find_replace.py @@ -4,6 +4,7 @@ import numpy as np import pytest +from pandas.compat import pa_version_under13p0 import pandas.util._test_decorators as td import pandas as pd @@ -939,13 +940,22 @@ def test_find_bad_arg_raises(any_string_dtype): ser.str.rfind(0) -def test_find_nan(any_string_dtype): +def test_find_nan(any_string_dtype, request): ser = Series( ["ABCDEFG", np.nan, "DEFGHIJEF", np.nan, "XXXX"], dtype=any_string_dtype ) expected_dtype = ( np.float64 if is_object_or_nan_string_dtype(any_string_dtype) else "Int64" ) + if ( + pa_version_under13p0 + and isinstance(ser.dtype, pd.StringDtype) + and ser.dtype.storage == "pyarrow" + ): + # https://github.com/apache/arrow/issues/36311 + mark = pytest.mark.xfail(reason="https://github.com/apache/arrow/issues/36311") + # raises pa.lib.ArrowInvalid with Negative buffer resize + request.node.add_marker(mark) result = ser.str.find("EF") expected = Series([4, np.nan, 1, np.nan, -1], dtype=expected_dtype)