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/15 21:15:39 UTC

svn commit: r1514445 - /incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py

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()