Skip to content

Commit 6b57a69

Browse files
TST: fix casting extension tests for external users (#41278)
1 parent 30bf465 commit 6b57a69

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tests/extension/base/casting.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
import pandas.util._test_decorators as td
5+
46
import pandas as pd
57
from pandas.core.internals import ObjectBlock
68
from pandas.tests.extension.base.base import BaseExtensionTests
@@ -43,8 +45,19 @@ def test_astype_str(self, data):
4345
expected = pd.Series([str(x) for x in data[:5]], dtype=str)
4446
self.assert_series_equal(result, expected)
4547

48+
@pytest.mark.parametrize(
49+
"nullable_string_dtype",
50+
[
51+
"string",
52+
pytest.param(
53+
"arrow_string", marks=td.skip_if_no("pyarrow", min_version="1.0.0")
54+
),
55+
],
56+
)
4657
def test_astype_string(self, data, nullable_string_dtype):
4758
# GH-33465
59+
from pandas.core.arrays.string_arrow import ArrowStringDtype # noqa: F401
60+
4861
result = pd.Series(data[:5]).astype(nullable_string_dtype)
4962
expected = pd.Series([str(x) for x in data[:5]], dtype=nullable_string_dtype)
5063
self.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)