Skip to content

Migrate Figure.legend tests to use dvc #1166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
4 changes: 4 additions & 0 deletions pygmt/tests/baseline/test_legend_default_position.png.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
outs:
- md5: 7cc85638c576d10348126373fc2a5762
size: 25898
path: test_legend_default_position.png
Binary file removed pygmt/tests/baseline/test_legend_position.png
Binary file not shown.
4 changes: 4 additions & 0 deletions pygmt/tests/baseline/test_legend_position.png.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
outs:
- md5: d794a59f0fbdb7c8e8a4a1ea5c741470
size: 24298
path: test_legend_position.png
Binary file removed pygmt/tests/baseline/test_legend_specfile.png
Binary file not shown.
4 changes: 4 additions & 0 deletions pygmt/tests/baseline/test_legend_specfile.png.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
outs:
- md5: 5d0420febe0e0a5ae9ffc0a67879fc61
size: 61634
path: test_legend_specfile.png
13 changes: 2 additions & 11 deletions pygmt/tests/test_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,22 @@
@pytest.mark.mpl_image_compare
def test_legend_position():
"""
Try positioning with each of the four legend coordinate systems.
Test that plots a position with each of the four legend coordinate systems.
"""

fig = Figure()

fig.basemap(region=[-2, 2, -2, 2], frame=True)

positions = ["jTR+jTR", "g0/1", "n0.2/0.2", "x4i/2i/2i"]

for i, position in enumerate(positions):

fig.plot(x=[0], y=[0], style="p10p", label=i)
fig.legend(position=position, box=True)

return fig


@pytest.mark.mpl_image_compare
def test_legend_default_position():
"""
Try using the default legend position.
Test using the default legend position.
"""

fig = Figure()
Expand Down Expand Up @@ -98,15 +93,11 @@ def test_legend_specfile():
"""

with GMTTempFile() as specfile:

with open(specfile.name, "w") as file:
file.write(specfile_contents)

fig = Figure()

fig.basemap(projection="x6i", region=[0, 1, 0, 1], frame=True)
fig.legend(specfile.name, position="JTM+jCM+w5i")

return fig


Expand Down