Skip to content

Commit 4f7fb6c

Browse files
committed
Add tests for panda.Series with pandas numeric dtypes
1 parent 27fa075 commit 4f7fb6c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pygmt/tests/test_clib_to_numpy.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,29 @@ def test_to_numpy_pandas_series_numpy_dtypes_numeric(dtype, supported):
145145
result = _to_numpy(series)
146146
_check_result(result, supported)
147147
npt.assert_array_equal(result, series)
148+
149+
150+
@pytest.mark.parametrize(
151+
("dtype", "supported"),
152+
[
153+
pytest.param(pd.Int8Dtype(), True, id="Int8"),
154+
pytest.param(pd.Int16Dtype(), True, id="Int16"),
155+
pytest.param(pd.Int32Dtype(), True, id="Int32"),
156+
pytest.param(pd.Int64Dtype(), True, id="Int64"),
157+
pytest.param(pd.UInt8Dtype(), True, id="UInt8"),
158+
pytest.param(pd.UInt16Dtype(), True, id="UInt16"),
159+
pytest.param(pd.UInt32Dtype(), True, id="UInt32"),
160+
pytest.param(pd.UInt64Dtype(), True, id="UInt64"),
161+
pytest.param(pd.Float32Dtype(), True, id="Float32"),
162+
pytest.param(pd.Float64Dtype(), True, id="Float64"),
163+
],
164+
)
165+
def test_to_numpy_pandas_series_pandas_dtypes_numeric(dtype, supported):
166+
"""
167+
Test the _to_numpy function with pandas.Series of pandas numeric dtypes.
168+
"""
169+
series = pd.Series([1, 2, 3], dtype=dtype)
170+
assert series.dtype == dtype
171+
result = _to_numpy(series)
172+
_check_result(result, supported)
173+
npt.assert_array_equal(result, series)

0 commit comments

Comments
 (0)