-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate tests for gmtinfo and grdinfo (#461)
Separate the tests of grdinfo into test_grdinfo.py
- Loading branch information
Showing
2 changed files
with
29 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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,28 @@ | ||
""" | ||
Tests for grdinfo | ||
""" | ||
import numpy as np | ||
import pytest | ||
|
||
from .. import grdinfo | ||
from ..datasets import load_earth_relief | ||
from ..exceptions import GMTInvalidInput | ||
|
||
|
||
def test_grdinfo(): | ||
"Make sure grd info works as expected" | ||
grid = load_earth_relief() | ||
result = grdinfo(grid, L=0, C="n") | ||
assert result.strip() == "-180 180 -90 90 -8592.14453125 5558.79248047 1 1 361 181" | ||
|
||
|
||
def test_grdinfo_file(): | ||
"Test grdinfo with file input" | ||
result = grdinfo("@earth_relief_60m", L=0, C="n") | ||
assert result.strip() == "-180 180 -90 90 -8592.14465255 5558.79248047 1 1 361 181" | ||
|
||
|
||
def test_grdinfo_fails(): | ||
"Check that grdinfo fails correctly" | ||
with pytest.raises(GMTInvalidInput): | ||
grdinfo(np.arange(10).reshape((5, 2))) |
This file contains 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