Skip to content

Commit 702384d

Browse files
committed
Revert changes to test_strings.py
1 parent 05ae24f commit 702384d

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

pandas/core/arrays/string_arrow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ def _str_contains(
344344
na=lib.no_default,
345345
regex: bool = True,
346346
):
347-
if isinstance(pat, re.Pattern):
348-
pat = pat.pattern
347+
if (isinstance(pat, re.Pattern) and regex) or flags:
348+
return super()._str_contains(pat, case, flags, na, regex)
349349

350350
return ArrowStringArrayMixin._str_contains(self, pat, case, flags, na, regex)
351351

pandas/tests/strings/test_strings.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
datetime,
33
timedelta,
44
)
5-
import re
65

76
import numpy as np
87
import pytest
98

10-
pytest.importorskip("pyarrow")
11-
129
from pandas import (
1310
DataFrame,
1411
Index,
@@ -179,16 +176,6 @@ def test_empty_str_methods(any_string_dtype):
179176
tm.assert_series_equal(empty_str, empty.str.translate(table))
180177

181178

182-
@pytest.mark.parametrize("dtype", ["string[pyarrow]"])
183-
def test_str_contains_compiled_regex_arrow_dtype(dtype):
184-
ser = Series(["foo", "bar", "baz"], dtype=dtype)
185-
pat = re.compile("ba.")
186-
result = ser.str.contains(pat)
187-
assert str(result.dtype) == "bool[pyarrow]"
188-
expected = Series([False, True, True], dtype="bool[pyarrow]")
189-
tm.testing.assert_series_equal(result, expected)
190-
191-
192179
@pytest.mark.parametrize(
193180
"method, expected",
194181
[

0 commit comments

Comments
 (0)