|
39 | 39 | from pandas.errors import PerformanceWarning
|
40 | 40 |
|
41 | 41 | from pandas.core.dtypes.common import is_any_int_dtype
|
| 42 | +from pandas.core.dtypes.dtypes import CategoricalDtypeType |
42 | 43 |
|
43 | 44 | import pandas as pd
|
44 | 45 | import pandas._testing as tm
|
@@ -1530,9 +1531,23 @@ def test_mode_dropna_false_mode_na(data):
|
1530 | 1531 | tm.assert_series_equal(result, expected)
|
1531 | 1532 |
|
1532 | 1533 |
|
1533 |
| -@pytest.mark.parametrize("arrow_dtype", [pa.binary(), pa.binary(16), pa.large_binary()]) |
1534 |
| -def test_arrow_dtype_type(arrow_dtype): |
1535 |
| - assert ArrowDtype(arrow_dtype).type == bytes |
| 1534 | +@pytest.mark.parametrize( |
| 1535 | + "arrow_dtype, expected_type", |
| 1536 | + [ |
| 1537 | + [pa.binary(), bytes], |
| 1538 | + [pa.binary(16), bytes], |
| 1539 | + [pa.large_binary(), bytes], |
| 1540 | + [pa.large_string(), str], |
| 1541 | + [pa.list_(pa.int64()), list], |
| 1542 | + [pa.large_list(pa.int64()), list], |
| 1543 | + [pa.map_(pa.string(), pa.int64()), dict], |
| 1544 | + [pa.dictionary(pa.int64(), pa.int64()), CategoricalDtypeType], |
| 1545 | + ], |
| 1546 | +) |
| 1547 | +def test_arrow_dtype_type(arrow_dtype, expected_type): |
| 1548 | + # GH 51845 |
| 1549 | + # TODO: Redundant with test_getitem_scalar once arrow_dtype exists in data fixture |
| 1550 | + assert ArrowDtype(arrow_dtype).type == expected_type |
1536 | 1551 |
|
1537 | 1552 |
|
1538 | 1553 | def test_is_bool_dtype():
|
@@ -1925,7 +1940,7 @@ def test_str_get(i, exp):
|
1925 | 1940 |
|
1926 | 1941 | @pytest.mark.xfail(
|
1927 | 1942 | reason="TODO: StringMethods._validate should support Arrow list types",
|
1928 |
| - raises=NotImplementedError, |
| 1943 | + raises=AttributeError, |
1929 | 1944 | )
|
1930 | 1945 | def test_str_join():
|
1931 | 1946 | ser = pd.Series(ArrowExtensionArray(pa.array([list("abc"), list("123"), None])))
|
|
0 commit comments