Skip to content

Commit 6f966db

Browse files
committed
Add tests for Python built-in types
1 parent a9635b5 commit 6f966db

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pygmt/tests/test_clib_to_numpy.py

+19
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ def _check_result(result, supported):
2121
assert (result.dtype.type in DTYPES) == supported
2222

2323

24+
########################################################################################
25+
# Test the _to_numpy function with Python built-in types.
26+
########################################################################################
27+
@pytest.mark.parametrize(
28+
("data", "supported"),
29+
[
30+
pytest.param([1, 2, 3], True, id="int"),
31+
pytest.param([1.0, 2.0, 3.0], True, id="float"),
32+
],
33+
)
34+
def test_to_numpy_python_types_numeric(data, supported):
35+
"""
36+
Test the _to_numpy function with Python built-in numeric types.
37+
"""
38+
result = _to_numpy(data)
39+
_check_result(result, supported)
40+
npt.assert_array_equal(result, data)
41+
42+
2443
########################################################################################
2544
# Test the _to_numpy function with NumPy arrays.
2645
#

0 commit comments

Comments
 (0)