diff --git a/pandas/tests/extension/test_integer.py b/pandas/tests/extension/test_integer.py index 7d343aab3c7a0..a4ade3864c007 100644 --- a/pandas/tests/extension/test_integer.py +++ b/pandas/tests/extension/test_integer.py @@ -249,3 +249,21 @@ class TestParsing(base.BaseParsingTests): class Test2DCompat(base.Dim2CompatTests): pass + + +def test_from_arrow(dtype): + pyarrow = pytest.importorskip("pyarrow") + + def types_mapper(arrow_type): + if pyarrow.types.is_integer(arrow_type): + return dtype + + pyarrow_array = pyarrow.array([1, None, 2], type=pyarrow.int64()) + expected = pd.Series([1, None, 2], dtype=dtype.name) + + # Convert to RecordBatch because types_mapper argument is ignored when + # using a pyarrow.Array. https://issues.apache.org/jira/browse/ARROW-9664 + record_batch = pyarrow.RecordBatch.from_arrays([pyarrow_array], ["test_col"]) + dataframe = record_batch.to_pandas(types_mapper=types_mapper) + series = dataframe["test_col"] + tm.assert_series_equal(series, expected, check_names=False)