Skip to content

Commit f035363

Browse files
committed
Fix test case and move import
1 parent 55e8a0d commit f035363

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

pandas/tests/strings/test_extract.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
import re
33

44
import numpy as np
5-
import pyarrow as pa
65
import pytest
76

7+
from pandas.core.dtypes.dtypes import ArrowDtype
8+
89
from pandas import (
910
DataFrame,
1011
Index,
1112
MultiIndex,
1213
Series,
1314
_testing as tm,
1415
)
15-
from pandas.core.dtypes.dtypes import ArrowDtype
1616

1717

1818
def test_extract_expand_kwarg_wrong_type_raises(any_string_dtype):
@@ -710,16 +710,10 @@ def test_extractall_same_as_extract_subject_index(any_string_dtype):
710710
tm.assert_frame_equal(extract_one_noname, no_match_index)
711711

712712

713-
@pytest.mark.parametrize(
714-
"data, expected_dtype",
715-
[
716-
(Series(["abc", "ab"], dtype=ArrowDtype(pa.string())), "string[pyarrow]"),
717-
(Series(["abc", "ab"], dtype="string"), "string[python]"),
718-
(Series(["abc", "ab"]), "object"),
719-
]
720-
)
721713
def test_extractall_preserves_dtype(data, expected_dtype):
722714
# Ensure that when extractall is called on a series with specific dtypes set, that
723715
# the dtype is preserved in the resulting DataFrame's column.
724-
result = data.str.extractall("(ab)")
725-
assert result.dtypes[0] == expected_dtype
716+
import pyarrow as pa
717+
718+
result = Series(["abc", "ab"], dtype=ArrowDtype(pa.string())).str.extractall("(ab)")
719+
assert result.dtypes[0] == "string[pyarrow]"

0 commit comments

Comments
 (0)