Skip to content

Commit 3318ab1

Browse files
authored
Merge branch 'main' into AliasSystem/projection
2 parents 3f6192f + f8bf595 commit 3318ab1

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

pygmt/src/grdimage.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66
from pygmt._typing import PathLike
77
from pygmt.alias import AliasSystem
88
from pygmt.clib import Session
9-
from pygmt.exceptions import GMTInvalidInput
10-
from pygmt.helpers import (
11-
build_arg_list,
12-
fmt_docstring,
13-
kwargs_to_strings,
14-
use_alias,
15-
)
9+
from pygmt.helpers import build_arg_list, fmt_docstring, kwargs_to_strings, use_alias
1610

1711
__doctest_skip__ = ["grdimage"]
1812

@@ -171,7 +165,7 @@ def grdimage(
171165
"Parameter 'img_out'/'A' is not implemented. "
172166
"Please consider submitting a feature request to us."
173167
)
174-
raise GMTInvalidInput(msg)
168+
raise NotImplementedError(msg)
175169

176170
aliasdict = AliasSystem().add_common(
177171
J=projection,

pygmt/tests/test_alias_system.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def func(
1515
label=None,
1616
text=None,
1717
offset=None,
18+
panel=False,
1819
**kwargs,
1920
):
2021
"""
@@ -30,6 +31,7 @@ def func(
3031
],
3132
).add_common(
3233
J=projection,
34+
c=panel,
3335
)
3436
aliasdict.merge(kwargs)
3537
return build_arg_list(aliasdict)
@@ -97,3 +99,14 @@ def test_alias_system_multiple_aliases_short_form():
9799

98100
with pytest.raises(GMTInvalidInput, match=msg):
99101
func(text="efg", U="efg")
102+
103+
104+
def test_alias_system_common_parameter_panel():
105+
"""
106+
Test that the alias system works with the panel parameter.
107+
"""
108+
assert func(panel=True) == ["-c"]
109+
assert func(panel=False) == []
110+
assert func(panel=(1, 2)) == ["-c1,2"]
111+
assert func(panel=1) == ["-c1"]
112+
assert func(panel="1,2") == ["-c1,2"]

pygmt/tests/test_grdimage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from pygmt.clib import __gmt_version__
1111
from pygmt.datasets import load_earth_relief
1212
from pygmt.enums import GridRegistration, GridType
13-
from pygmt.exceptions import GMTInvalidInput, GMTTypeError
13+
from pygmt.exceptions import GMTTypeError
1414
from pygmt.helpers.testing import check_figures_equal
1515

1616

@@ -252,9 +252,9 @@ def test_grdimage_imgout_fails(grid):
252252
Test that an exception is raised if img_out/A is given.
253253
"""
254254
fig = Figure()
255-
with pytest.raises(GMTInvalidInput):
255+
with pytest.raises(NotImplementedError):
256256
fig.grdimage(grid, img_out="out.png")
257-
with pytest.raises(GMTInvalidInput):
257+
with pytest.raises(NotImplementedError):
258258
fig.grdimage(grid, A="out.png")
259259

260260

0 commit comments

Comments
 (0)