Skip to content

Commit

Permalink
Add tests for Python built-in types
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Nov 6, 2024
1 parent a9635b5 commit 6f966db
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pygmt/tests/test_clib_to_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ def _check_result(result, supported):
assert (result.dtype.type in DTYPES) == supported


########################################################################################
# Test the _to_numpy function with Python built-in types.
########################################################################################
@pytest.mark.parametrize(
("data", "supported"),
[
pytest.param([1, 2, 3], True, id="int"),
pytest.param([1.0, 2.0, 3.0], True, id="float"),
],
)
def test_to_numpy_python_types_numeric(data, supported):
"""
Test the _to_numpy function with Python built-in numeric types.
"""
result = _to_numpy(data)
_check_result(result, supported)
npt.assert_array_equal(result, data)


########################################################################################
# Test the _to_numpy function with NumPy arrays.
#
Expand Down

0 comments on commit 6f966db

Please sign in to comment.