@@ -159,20 +159,10 @@ def test_to_numpy_ndarray_numpy_dtypes_numeric(dtype, expected_dtype):
159
159
# 2. https://pandas.pydata.org/docs/user_guide/basics.html#basics-dtypes
160
160
# 3. https://pandas.pydata.org/docs/user_guide/pyarrow.html
161
161
########################################################################################
162
- @pytest .mark .parametrize (("dtype" , "expected_dtype" ), np_dtype_params )
163
- def test_to_numpy_pandas_series_numpy_dtypes_numeric (dtype , expected_dtype ):
164
- """
165
- Test the _to_numpy function with pandas.Series of NumPy numeric dtypes.
166
- """
167
- series = pd .Series ([1 , 2 , 3 , 4 , 5 , 6 ], dtype = dtype )[::2 ] # Not C-contiguous
168
- result = _to_numpy (series )
169
- _check_result (result , expected_dtype )
170
- npt .assert_array_equal (result , series )
171
-
172
-
173
162
@pytest .mark .parametrize (
174
163
("dtype" , "expected_dtype" ),
175
164
[
165
+ * np_dtype_params ,
176
166
pytest .param (pd .Int8Dtype (), np .int8 , id = "Int8" ),
177
167
pytest .param (pd .Int16Dtype (), np .int16 , id = "Int16" ),
178
168
pytest .param (pd .Int32Dtype (), np .int32 , id = "Int32" ),
@@ -196,16 +186,16 @@ def test_to_numpy_pandas_series_numpy_dtypes_numeric(dtype, expected_dtype):
196
186
pytest .param ("float64[pyarrow]" , np .float64 , id = "float64[pyarrow]" , ** pa_marks ),
197
187
],
198
188
)
199
- def test_to_numpy_pandas_series_pandas_dtypes_numeric (dtype , expected_dtype ):
189
+ def test_to_numpy_pandas_numeric (dtype , expected_dtype ):
200
190
"""
201
- Test the _to_numpy function with pandas.Series of pandas/PyArrow numeric dtypes.
191
+ Test the _to_numpy function with pandas.Series of NumPy/pandas/PyArrow numeric
192
+ dtypes.
202
193
"""
203
194
data = [1.0 , 2.0 , 3.0 , 4.0 , 5.0 , 6.0 ]
204
195
if dtype == "float16[pyarrow]" and Version (pd .__version__ ) < Version ("2.2" ):
205
196
# float16 needs special handling for pandas < 2.2.
206
197
# Example from https://arrow.apache.org/docs/python/generated/pyarrow.float16.html
207
198
data = np .array (data , dtype = np .float16 )
208
-
209
199
series = pd .Series (data , dtype = dtype )[::2 ] # Not C-contiguous
210
200
result = _to_numpy (series )
211
201
_check_result (result , expected_dtype )
0 commit comments