Skip to content

Commit 4edfef0

Browse files
seismanweiji14
andauthored
Add test for Python built-in complex dtype
Co-authored-by: Wei Ji <[email protected]>
1 parent 933bc62 commit 4edfef0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pygmt/tests/test_clib_to_numpy.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ def _check_result(result, expected_dtype):
2727
[
2828
pytest.param([1, 2, 3], np.int64, id="int"),
2929
pytest.param([1.0, 2.0, 3.0], np.float64, id="float"),
30+
pytest.param(
31+
[complex(+1), complex(-2j), complex("-Infinity+NaNj")],
32+
np.complex128,
33+
id="complex",
34+
),
3035
],
3136
)
3237
def test_to_numpy_python_types_numeric(data, expected_dtype):
@@ -83,7 +88,7 @@ def test_to_numpy_ndarray_numpy_dtypes_numeric(dtype, expected_dtype):
8388
"""
8489
Test the _to_numpy function with NumPy arrays of NumPy numeric dtypes.
8590
86-
Test both 1-D and 2-D arrays.
91+
Test both 1-D and 2-D arrays which are not C-contiguous.
8792
"""
8893
# 1-D array that is not C-contiguous
8994
array = np.array([1, 2, 3, 4, 5, 6], dtype=dtype)[::2]

0 commit comments

Comments
 (0)