@@ -173,6 +173,28 @@ def test_to_numpy_pandas_series_numpy_dtypes_numeric(dtype, expected_dtype):
173
173
npt .assert_array_equal (result , series )
174
174
175
175
176
+ @pytest .mark .skipif (not _HAS_PYARROW , reason = "pyarrow is not installed" )
177
+ @pytest .mark .parametrize (
178
+ ("dtype" , "expected_dtype" ),
179
+ [
180
+ pytest .param ("date32[day][pyarrow]" , "datetime64[D]" , id = "date32[day]" ),
181
+ pytest .param ("date64[ms][pyarrow]" , "datetime64[ms]" , id = "date64[ms]" ),
182
+ ],
183
+ )
184
+ def test_to_numpy_pandas_series_pyarrow_dtypes_date (dtype , expected_dtype ):
185
+ """
186
+ Test the _to_numpy function with pandas.Series of PyArrow date32/date64 types.
187
+ """
188
+ series = pd .Series (pd .date_range (start = "2024-01-01" , periods = 3 ), dtype = dtype )
189
+ result = _to_numpy (series )
190
+ _check_result (result , np .datetime64 )
191
+ assert result .dtype == expected_dtype # Explicitly check the date unit.
192
+ npt .assert_array_equal (
193
+ result ,
194
+ np .array (["2024-01-01" , "2024-01-02" , "2024-01-03" ], dtype = expected_dtype ),
195
+ )
196
+
197
+
176
198
########################################################################################
177
199
# Test the _to_numpy function with PyArrow arrays.
178
200
#
0 commit comments