-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
7 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from base_case import BaseCase | ||
from ctsm.base_case import BaseCase | ||
|
||
import numpy as np | ||
import xarray as xr | ||
|
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
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
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,32 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import unittest | ||
import argparse | ||
|
||
from ctsm.subset_data import plon_type | ||
from ctsm import unit_testing | ||
|
||
# Allow names that pylint doesn't like, because otherwise I find it hard | ||
# to make readable unit test names | ||
# pylint: disable=invalid-name | ||
|
||
class TestSubsetData(unittest.TestCase): | ||
|
||
def test_plonType_positive(self): | ||
result = plon_type(30) | ||
self.assertEqual(result, 30.) | ||
|
||
def test_plonType_negative(self): | ||
result = plon_type(-30) | ||
self.assertEqual(result, 330.) | ||
|
||
def test_plonType_outOfBounds(self): | ||
with self.assertRaisesRegex(argparse.ArgumentTypeError, | ||
"Latitude.*should be between"): | ||
_ = plon_type(361) | ||
|
||
"""Unit tests for subset_data | ||
""" | ||
if __name__ == '__main__': | ||
unit_testing.setup_for_tests() | ||
unittest.main() |