Skip to content

Commit

Permalink
Remove test_data_kind_fails because it's already covered by validate_…
Browse files Browse the repository at this point in the history
…data_input doctests
  • Loading branch information
seisman committed Jul 17, 2024
1 parent e79a7d0 commit e2a8ceb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 27 deletions.
4 changes: 4 additions & 0 deletions pygmt/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def validate_data_input(
Traceback (most recent call last):
...
pygmt.exceptions.GMTInvalidInput: Too much data. Use either data or x/y/z.
>>> validate_data_input(data="infile", x=[1, 2, 3], y=[4, 5, 6])
Traceback (most recent call last):
...
pygmt.exceptions.GMTInvalidInput: Too much data. Use either data or x/y/z.
>>> validate_data_input(data="infile", z=[7, 8, 9])
Traceback (most recent call last):
...
Expand Down
28 changes: 1 addition & 27 deletions pygmt/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@

from pathlib import Path

import numpy as np
import pytest
import xarray as xr
from pygmt import Figure
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import (
GMTTempFile,
args_in_kwargs,
data_kind,
kwargs_to_strings,
unique_name,
)
from pygmt.helpers import GMTTempFile, args_in_kwargs, kwargs_to_strings, unique_name
from pygmt.helpers.testing import load_static_earth_relief, skip_if_no


Expand All @@ -32,25 +25,6 @@ def test_load_static_earth_relief():
assert isinstance(data, xr.DataArray)


@pytest.mark.parametrize(
("data", "x", "y"),
[
(None, None, None),
("data.txt", np.array([1, 2]), np.array([4, 5])),
("data.txt", np.array([1, 2]), None),
("data.txt", None, np.array([4, 5])),
(None, np.array([1, 2]), None),
(None, None, np.array([4, 5])),
],
)
def test_data_kind_fails(data, x, y):
"""
Make sure data_kind raises exceptions when it should.
"""
with pytest.raises(GMTInvalidInput):
data_kind(data=data, x=x, y=y)


def test_unique_name():
"""
Make sure the names are really unique.
Expand Down

0 comments on commit e2a8ceb

Please sign in to comment.