Skip to content

Commit

Permalink
Migrate pygmt.grd2cpt tests to use dvc (#1162)
Browse files Browse the repository at this point in the history
Co-authored-by: Dongdong Tian <[email protected]>
  • Loading branch information
willschlitzer and seisman authored Apr 2, 2021
1 parent 2893798 commit e96fa47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 4 additions & 0 deletions pygmt/tests/baseline/test_grd2cpt.png.dvc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
outs:
- md5: 0848349770986ef56d740e866ab961bc
size: 24843
path: test_grd2cpt.png
18 changes: 6 additions & 12 deletions pygmt/tests/test_grd2cpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
import os

import pytest
from pygmt import Figure
from pygmt import Figure, grd2cpt
from pygmt.datasets import load_earth_relief
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import GMTTempFile
from pygmt.helpers.testing import check_figures_equal
from pygmt.src.grd2cpt import grd2cpt


@pytest.fixture(scope="module", name="grid")
Expand All @@ -20,21 +18,17 @@ def fixture_grid():
return load_earth_relief()


@check_figures_equal()
@pytest.mark.mpl_image_compare
def test_grd2cpt(grid):
"""
Test creating a CPT with grd2cpt to create a CPT based off a grid input and
plot it with a color bar.
"""
fig_ref, fig_test = Figure(), Figure()
# Use single-character arguments for the reference image
fig_ref.basemap(B="a", J="W0/15c", R="d")
grd2cpt(grid="@earth_relief_01d")
fig_ref.colorbar(B="a2000")
fig_test.basemap(frame="a", projection="W0/15c", region="d")
fig = Figure()
fig.basemap(frame="a", projection="W0/15c", region="d")
grd2cpt(grid=grid)
fig_test.colorbar(frame="a2000")
return fig_ref, fig_test
fig.colorbar(frame="a2000")
return fig


def test_grd2cpt_blank_output(grid):
Expand Down

0 comments on commit e96fa47

Please sign in to comment.