Skip to content

Commit 3414f69

Browse files
willschlitzerseismanweiji14
authored
Migrate Figure.inset tests to use dvc (#1163)
Co-authored-by: Dongdong Tian <[email protected]> Co-authored-by: Wei Ji <[email protected]>
1 parent 561ea84 commit 3414f69

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: f6ddb4129474219bfa30154614a189a5
3+
size: 31937
4+
path: test_inset_aliases.png
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: c06c3d8cbeb5b9b7ae977870b4c825d9
3+
size: 13322
4+
path: test_inset_context_manager.png

pygmt/tests/test_inset.py

+14-25
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,31 @@
11
"""
22
Tests for the inset function.
33
"""
4+
import pytest
45
from pygmt import Figure
5-
from pygmt.helpers.testing import check_figures_equal
66

77

8-
@check_figures_equal()
8+
@pytest.mark.mpl_image_compare
99
def test_inset_aliases():
1010
"""
1111
Test the aliases for the inset function.
1212
"""
13-
fig_ref, fig_test = Figure(), Figure()
14-
fig_ref.basemap(R="MG+r2", B="afg")
15-
with fig_ref.inset(D="jTL+w3.5c+o0.2c", M=0, F="+pgreen"):
16-
fig_ref.basemap(R="g", J="G47/-20/4c", B="afg")
13+
fig = Figure()
14+
fig.basemap(region="MG+r2", frame="afg")
15+
with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+pgreen"):
16+
fig.basemap(region="g", projection="G47/-20/4c", frame="afg")
17+
return fig
1718

18-
fig_test.basemap(region="MG+r2", frame="afg")
19-
with fig_test.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+pgreen"):
20-
fig_test.basemap(region="g", projection="G47/-20/4c", frame="afg")
21-
return fig_ref, fig_test
2219

23-
24-
@check_figures_equal()
20+
@pytest.mark.mpl_image_compare
2521
def test_inset_context_manager():
2622
"""
2723
Test that the inset context manager works and, once closed, plotting
2824
elements are added to the larger figure.
2925
"""
30-
fig_ref, fig_test = Figure(), Figure()
31-
32-
fig_ref.basemap(region=[-74, -69.5, 41, 43], projection="M9c", frame=True)
33-
fig_ref.basemap(rose="jTR+w3c") # Pass rose argument with basemap before the inset
34-
with fig_ref.inset(position="jBL+w3c+o0.2c", margin=0, box="+pblack"):
35-
fig_ref.basemap(region=[-80, -65, 35, 50], projection="M3c", frame="afg")
36-
37-
fig_test.basemap(region=[-74, -69.5, 41, 43], projection="M9c", frame=True)
38-
with fig_test.inset(position="jBL+w3c+o0.2c", margin=0, box="+pblack"):
39-
fig_test.basemap(region=[-80, -65, 35, 50], projection="M3c", frame="afg")
40-
fig_test.basemap(rose="jTR+w3c") # Pass rose argument with basemap after the inset
41-
42-
return fig_ref, fig_test
26+
fig = Figure()
27+
fig.basemap(region=[-74, -69.5, 41, 43], projection="M9c", frame=True)
28+
with fig.inset(position="jBL+w3c+o0.2c", margin=0, box="+pblack"):
29+
fig.basemap(region=[-80, -65, 35, 50], projection="M3c", frame="afg")
30+
fig.basemap(rose="jTR+w3c") # Pass rose argument with basemap after the inset
31+
return fig

0 commit comments

Comments
 (0)