climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1514445 - /incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py
Date Thu, 15 Aug 2013 19:15:39 GMT
Author: joyce
Date: Thu Aug 15 19:15:39 2013
New Revision: 1514445

URL: http://svn.apache.org/r1514445
Log:
CLIMATE-237 - Make repeated bad subregion tests easier to run.

Modified:
    incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py

Modified: incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py?rev=1514445&r1=1514444&r2=1514445&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py Thu Aug 15
19:15:39 2013
@@ -176,12 +176,7 @@ class TestSubset(unittest.TestCase):
             'end': datetime.datetime(2004, 1, 1)
         }
 
-        try: 
-            subset = dp.subset(subregion, target_dataset)
-            raise self.failureException()
-        except ValueError:
-            # We expect a value error to be raised since latMin is out of bounds
-            pass
+        _test_bad_subregion_object(subregion, target_dataset)
 
 
 def ten_year_monthly_dataset():
@@ -210,7 +205,16 @@ def build_ten_cube_dataset(value):
     dataset = ds.Dataset(lats, lons, times, values)
     return dataset
     
-
+def _test_bad_subregion_object(subregion, target_dataset):
+        try: 
+            subset = dp.subset(subregion, target_dataset)
+            # The subregion should be invalid so we shouldn't get here. If we
+            # do then our code is failing!!!
+            raise self.failureException()
+        except ValueError:
+            # We expect a ValueError since the subregion object is invalid in
+            # some way. Getting  that error means our test is successful!
+            pass
 
 if __name__ == '__main__':
     unittest.main()



Mime
View raw message