-
Notifications
You must be signed in to change notification settings - Fork 228
Migrate Figure.inset tests to use dvc #1163
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
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
847e5ec
Change test_inset_aliases to use mpl_image_compare
willschlitzer 5feeaa1
add import pytest to test_inset.py
willschlitzer 5c757c1
add test_inset_aliases.png.dvc
willschlitzer 8a04578
change test_inset_context_manager() to use mpl_image_compare
willschlitzer d321d21
add test_inset_context_manager.png.dvc
willschlitzer fbec8c3
Merge branch 'master' into test-inset-dvc
willschlitzer 85a365d
Remove check_figures_equal
seisman 0b847ff
Merge branch 'master' into test-inset-dvc
seisman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
outs: | ||
- md5: f6ddb4129474219bfa30154614a189a5 | ||
size: 31937 | ||
path: test_inset_aliases.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
outs: | ||
- md5: c06c3d8cbeb5b9b7ae977870b4c825d9 | ||
size: 13322 | ||
path: test_inset_context_manager.png |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,32 @@ | ||
""" | ||
Tests for the inset function. | ||
""" | ||
import pytest | ||
from pygmt import Figure | ||
from pygmt.helpers.testing import check_figures_equal | ||
|
||
|
||
@check_figures_equal() | ||
@pytest.mark.mpl_image_compare | ||
def test_inset_aliases(): | ||
""" | ||
Test the aliases for the inset function. | ||
""" | ||
fig_ref, fig_test = Figure(), Figure() | ||
fig_ref.basemap(R="MG+r2", B="afg") | ||
with fig_ref.inset(D="jTL+w3.5c+o0.2c", M=0, F="+pgreen"): | ||
fig_ref.basemap(R="g", J="G47/-20/4c", B="afg") | ||
fig = Figure() | ||
fig.basemap(region="MG+r2", frame="afg") | ||
with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+pgreen"): | ||
fig.basemap(region="g", projection="G47/-20/4c", frame="afg") | ||
return fig | ||
|
||
fig_test.basemap(region="MG+r2", frame="afg") | ||
with fig_test.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+pgreen"): | ||
fig_test.basemap(region="g", projection="G47/-20/4c", frame="afg") | ||
return fig_ref, fig_test | ||
|
||
|
||
@check_figures_equal() | ||
@pytest.mark.mpl_image_compare | ||
def test_inset_context_manager(): | ||
""" | ||
Test that the inset context manager works and, once closed, plotting | ||
elements are added to the larger figure. | ||
""" | ||
fig_ref, fig_test = Figure(), Figure() | ||
|
||
fig_ref.basemap(region=[-74, -69.5, 41, 43], projection="M9c", frame=True) | ||
fig_ref.basemap(rose="jTR+w3c") # Pass rose argument with basemap before the inset | ||
with fig_ref.inset(position="jBL+w3c+o0.2c", margin=0, box="+pblack"): | ||
fig_ref.basemap(region=[-80, -65, 35, 50], projection="M3c", frame="afg") | ||
|
||
fig_test.basemap(region=[-74, -69.5, 41, 43], projection="M9c", frame=True) | ||
with fig_test.inset(position="jBL+w3c+o0.2c", margin=0, box="+pblack"): | ||
fig_test.basemap(region=[-80, -65, 35, 50], projection="M3c", frame="afg") | ||
fig_test.basemap(rose="jTR+w3c") # Pass rose argument with basemap after the inset | ||
|
||
return fig_ref, fig_test | ||
fig = Figure() | ||
fig.basemap(region=[-74, -69.5, 41, 43], projection="M9c", frame=True) | ||
with fig.inset(position="jBL+w3c+o0.2c", margin=0, box="+pblack"): | ||
fig.basemap(region=[-80, -65, 35, 50], projection="M3c", frame="afg") | ||
fig.basemap(rose="jTR+w3c") # Pass rose argument with basemap after the inset | ||
return fig |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.