@@ -48,11 +48,12 @@ def _check_result(result, expected_dtype):
48
48
np .complex128 ,
49
49
id = "complex" ,
50
50
),
51
+ pytest .param (["abc" , "defg" , "12345" ], np .str_ , id = "string" ),
51
52
],
52
53
)
53
- def test_to_numpy_python_types_numeric (data , expected_dtype ):
54
+ def test_to_numpy_python_types (data , expected_dtype ):
54
55
"""
55
- Test the _to_numpy function with Python built-in numeric types.
56
+ Test the _to_numpy function with Python built-in types.
56
57
"""
57
58
result = _to_numpy (data )
58
59
_check_result (result , expected_dtype )
@@ -121,6 +122,17 @@ def test_to_numpy_ndarray_numpy_dtypes_numeric(dtype, expected_dtype):
121
122
npt .assert_array_equal (result , array , strict = True )
122
123
123
124
125
+ @pytest .mark .parametrize ("dtype" , [None , np .str_ , "U10" ])
126
+ def test_to_numpy_ndarray_numpy_dtypes_string (dtype ):
127
+ """
128
+ Test the _to_numpy function with NumPy arrays of string types.
129
+ """
130
+ array = np .array (["abc" , "defg" , "12345" ], dtype = dtype )
131
+ result = _to_numpy (array )
132
+ _check_result (result , np .str_ )
133
+ npt .assert_array_equal (result , array )
134
+
135
+
124
136
########################################################################################
125
137
# Test the _to_numpy function with pandas.Series.
126
138
#
0 commit comments