-
Notifications
You must be signed in to change notification settings - Fork 214
/
test_coast.py
74 lines (64 loc) · 1.54 KB
/
test_coast.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"""
Test Figure.coast.
"""
import pytest
from pygmt import Figure
from pygmt.exceptions import GMTInvalidInput
@pytest.mark.mpl_image_compare
def test_coast_region():
"""
Test plotting a regional map with coastlines.
"""
fig = Figure()
fig.coast(region="JP", projection="M10c", frame=True, land="gray", shorelines=1)
return fig
@pytest.mark.mpl_image_compare
def test_coast_world_mercator():
"""
Test generating a global Mercator map with coastlines.
"""
fig = Figure()
fig.coast(
region=[-180, 180, -80, 80],
projection="M15c",
frame="af",
land="#aaaaaa",
resolution="c",
water="white",
)
return fig
def test_coast_required_args():
"""
Test if fig.coast fails when not given required arguments.
"""
fig = Figure()
with pytest.raises(GMTInvalidInput):
fig.coast(region="EG")
@pytest.mark.mpl_image_compare
def test_coast_dcw_single():
"""
Test passing a single country code to dcw.
"""
fig = Figure()
fig.coast(
region=[-10, 15, 25, 44],
frame="a",
projection="M15c",
land="brown",
dcw="ES+gbisque+pblue",
)
return fig
@pytest.mark.mpl_image_compare
def test_coast_dcw_list():
"""
Test passing a list of country codes and fill arguments to dcw.
"""
fig = Figure()
fig.coast(
region=[-10, 15, 25, 44],
frame="a",
projection="M15c",
land="brown",
dcw=["ES+gbisque+pgreen", "IT+gcyan+pblue"],
)
return fig