This repository has been archived by the owner on Oct 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from exTerEX/feature-11
Added tests and stuff, one commit due to error in other branch. Closes #11
- Loading branch information
Showing
6 changed files
with
99 additions
and
38 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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
API Referance | ||
================================ | ||
|
||
.. autoclass:: climate.api.NOAA | ||
.. autoclass:: climate.API | ||
:members: | ||
|
||
TODO: Include more info on available input values for some fields. |
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,77 @@ | ||
import unittest | ||
import sys | ||
from noaa.climate import API | ||
|
||
if len(sys.argv) != 2: | ||
sys.exit("ERROR: A command-line parameter must be supplied for these tests") | ||
|
||
|
||
obj = API(sys.argv[1]) | ||
|
||
|
||
class TestClimateApi(unittest.TestCase): | ||
def test_get_datasets(self): | ||
result = obj.get_datasets("GSOM") | ||
|
||
self.assertEqual(result["id"], "GSOM") | ||
self.assertIsInstance(result, dict) | ||
self.assertIsNotNone(result) | ||
|
||
result = obj.get_datasets(limit=5) | ||
|
||
result = obj.get_datasets( | ||
start_date="1970-10-03", | ||
end_date="2012-09-10" | ||
) | ||
|
||
self.assertIsInstance(result, dict) | ||
self.assertIsNotNone(result) | ||
|
||
result = obj.get_datasets( | ||
start_date="1970-10-03H10:10:10", | ||
end_date="2012-08-10H10:10:10" | ||
) | ||
|
||
self.assertIsInstance(result, dict) | ||
self.assertIsNotNone(result) | ||
|
||
self.assertLessEqual(len(result), 5) | ||
self.assertIsNotNone(result) | ||
|
||
def test_get_data_categories(self): | ||
result = obj.get_data_categories("ANNAGR") | ||
|
||
self.assertEqual(result["id"], "ANNAGR") | ||
self.assertIsInstance(result, dict) | ||
self.assertIsNotNone(result) | ||
|
||
def test_get_data_types(self): | ||
result = obj.get_data_types("ACMH") | ||
|
||
self.assertEqual(result["id"], "ACMH") | ||
self.assertIsInstance(result, dict) | ||
self.assertIsNotNone(result) | ||
|
||
def test_get_location_categories(self): | ||
result = obj.get_location_categories("CITY") | ||
|
||
def test_get_locations(self): | ||
result = obj.get_locations("FIPS:37") | ||
|
||
self.assertEqual(result["id"], "FIPS:37") | ||
self.assertIsInstance(result, dict) | ||
self.assertIsNotNone(result) | ||
|
||
def test_get_stations(self): | ||
result = obj.get_stations("COOP:010957") | ||
|
||
self.assertEqual(result["id"], "COOP:010957") | ||
self.assertIsInstance(result, dict) | ||
self.assertIsNotNone(result) | ||
|
||
def test_get_data(self): | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main(argv=["first-arg-is-ignored"], exit=False) |