Skip to content

Commit

Permalink
MNT: Add tests for the new functions. [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Taher Chegini committed Oct 6, 2024
1 parent d9924ba commit e5c0f60
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
from shapely import Polygon

import pygridmet as gridmet
from pygridmet import (
from pygridmet.cli import cli
from pygridmet.exceptions import (
InputRangeError,
InputTypeError,
InputValueError,
MissingCRSError,
MissingItemError,
)
from pygridmet.cli import cli

GEOM = Polygon(
[
Expand Down
13 changes: 13 additions & 0 deletions tests/test_pygridmet.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@ def test_coords(self, runner):
assert "Found coordinates of 1 point" in ret.output


def test_conus(runner):
fnames = gridmet.get_conus(2010, variables="tmmn")
assert fnames[0].exists()

save_dir = "test_conus"
ret = runner.invoke(cli, ["conus", "-y", 2010, "-v", "tmmn", "-s", save_dir])
assert Path(save_dir, "tmmn_2010.nc").exists()
shutil.rmtree(save_dir, ignore_errors=True)
assert str(ret.exception) == "None"
assert ret.exit_code == 0
assert "Getting CONUS data for 1 year and 1 variable" in ret.output


def test_show_versions():
f = io.StringIO()
gridmet.show_versions(file=f)
Expand Down

0 comments on commit e5c0f60

Please sign in to comment.