You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2013/08/16 16:27:07 UTC

svn commit: r1514726 - in /incubator/climate/branches/RefactorInput/ocw: dataset.py tests/test_dataset.py

Author: joyce
Date: Fri Aug 16 14:27:06 2013
New Revision: 1514726

URL: http://svn.apache.org/r1514726
Log:
CLIMATE-254 - Add tests for lat_min property

Modified:
    incubator/climate/branches/RefactorInput/ocw/dataset.py
    incubator/climate/branches/RefactorInput/ocw/tests/test_dataset.py

Modified: incubator/climate/branches/RefactorInput/ocw/dataset.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/dataset.py?rev=1514726&r1=1514725&r2=1514726&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/dataset.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/dataset.py Fri Aug 16 14:27:06 2013
@@ -178,7 +178,6 @@ class Bounds(object):
 
     @property
     def lat_min(self):
-        print self._lat_min
         return self._lat_min
 
     @lat_min.setter

Modified: incubator/climate/branches/RefactorInput/ocw/tests/test_dataset.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/tests/test_dataset.py?rev=1514726&r1=1514725&r2=1514726&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_dataset.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_dataset.py Fri Aug 16 14:27:06 2013
@@ -18,7 +18,7 @@
 '''Unit tests for the Dataset.py module'''
 
 import unittest
-from dataset import Dataset
+from ocw.dataset import Dataset, Bounds
 import numpy as np
 import datetime as dt
 
@@ -76,6 +76,23 @@ class TestDatasetFunctions(unittest.Test
     def test_temporal_resolution(self):
         self.assertEqual(self.test_dataset.temporal_resolution(), 'monthly')
 
+class TestBounds(unittest.TestCase):
+    def setUp(self):
+        self.bounds = Bounds(-80, 80,                # Lats
+                            -160, 160,               # Lons
+                            dt.datetime(2000, 1, 1), # Start time
+                            dt.datetime(2002, 1, 1)) # End time
+
+    def test_out_of_bounds_lat_min(self):
+        with self.assertRaises(ValueError):
+            self.bounds.lat_min = -91
+
+        with self.assertRaises(ValueError):
+            self.bounds.lat_min = 91
+
+    def test_inverted_min_max_lat(self):
+        with self.assertRaises(ValueError):
+            self.bounds.lat_min = 81
 
 if __name__ == '__main__':
     unittest.main()