Skip to content

Commit 069f5d8

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

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

pandas/tests/strings/test_extract.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import re
33

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

87
from pandas import (
@@ -710,16 +709,9 @@ def test_extractall_same_as_extract_subject_index(any_string_dtype):
710709
tm.assert_frame_equal(extract_one_noname, no_match_index)
711710

712711

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-
)
721712
def test_extractall_preserves_dtype(data, expected_dtype):
722713
# Ensure that when extractall is called on a series with specific dtypes set, that
723714
# the dtype is preserved in the resulting DataFrame's column.
724-
result = data.str.extractall("(ab)")
725-
assert result.dtypes[0] == expected_dtype
715+
import pyarrow as pa
716+
result = Series(["abc", "ab"], dtype=ArrowDtype(pa.string())).str.extractall("(ab)")
717+
assert result.dtypes[0] == "string[pyarrow]"

0 commit comments

Comments
 (0)