diff --git a/py-polars/tests/unit/interop/test_interop.py b/py-polars/tests/unit/interop/test_interop.py index 7f664e2fb197..2050d432cec5 100644 --- a/py-polars/tests/unit/interop/test_interop.py +++ b/py-polars/tests/unit/interop/test_interop.py @@ -766,3 +766,11 @@ def test_df_pycapsule_interface() -> None: df2 = pl.from_arrow(out) assert isinstance(df2, pl.DataFrame) assert df.equals(df2) + + +def test_misaligned_nested_arrow_19097() -> None: + a = pl.Series("a", [1, 2, 3]) + a = a.slice(1, 2) # by slicing we offset=1 the values + a = a.replace(2, None) # then we add a validity mask with offset=0 + a = a.reshape((2, 1)) # then we make it nested + assert_series_equal(pl.Series(a.to_arrow()), a)