Skip to content

Commit

Permalink
Use alias long-form for grdimage, text, and psconvert tests (GenericM…
Browse files Browse the repository at this point in the history
…appingTools#1570)

* Use alias long-form for grdimage, text, and psconvert tests

* Remove unnecessary psconvert test

Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
  • Loading branch information
2 people authored and Josh Sixsmith committed Dec 21, 2022
1 parent 77e195d commit d6b5d51
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pygmt/tests/test_grdimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_grdimage_over_dateline(xrgrid):
fig = Figure()
assert xrgrid.gmt.registration == 0 # gridline registration
xrgrid.gmt.gtype = 1 # geographic coordinate system
fig.grdimage(grid=xrgrid, region="g", projection="A0/0/1c", V="i")
fig.grdimage(grid=xrgrid, region="g", projection="A0/0/1c")
return fig


Expand Down
23 changes: 5 additions & 18 deletions pygmt/tests/test_psconvert.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def test_psconvert():
psconvert creates a figure in the current directory.
"""
fig = Figure()
fig.basemap(R="10/70/-3/8", J="X4i/3i", B="a")
fig.basemap(region="10/70/-3/8", projection="X4i/3i", frame="a")
prefix = "test_psconvert"
fig.psconvert(F=prefix, T="f", A=True)
fig.psconvert(prefix=prefix, fmt="f", crop=True)
fname = prefix + ".pdf"
assert os.path.exists(fname)
os.remove(fname)
Expand All @@ -24,28 +24,15 @@ def test_psconvert_twice():
Call psconvert twice to get two figures.
"""
fig = Figure()
fig.basemap(R="10/70/-3/8", J="X4i/3i", B="a")
fig.basemap(region="10/70/-3/8", projection="X4i/3i", frame="a")
prefix = "test_psconvert_twice"
# Make a PDF
fig.psconvert(F=prefix, T="f")
fig.psconvert(prefix=prefix, fmt="f")
fname = prefix + ".pdf"
assert os.path.exists(fname)
os.remove(fname)
# Make a PNG
fig.psconvert(F=prefix, T="g")
fname = prefix + ".png"
assert os.path.exists(fname)
os.remove(fname)


def test_psconvert_aliases():
"""
Use the aliases to make sure they work.
"""
fig = Figure()
fig.basemap(R="10/70/-3/8", J="X4i/3i", B="a")
prefix = "test_psconvert_aliases"
fig.psconvert(prefix=prefix, fmt="g", crop=True, dpi=100)
fig.psconvert(prefix=prefix, fmt="g")
fname = prefix + ".png"
assert os.path.exists(fname)
os.remove(fname)
2 changes: 1 addition & 1 deletion pygmt/tests/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def test_text_justify_parsed_from_textfile():
projection="H90/9i",
justify=True,
textfiles=CITIES_DATA,
D="j0.45/0+vred", # draw red-line from xy point to text label (city name)
offset="j0.45/0+vred", # draw red-line from xy point to text label (city name)
)
return fig

Expand Down

0 comments on commit d6b5d51

Please sign in to comment.