climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1514789 - /incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py
Date Fri, 16 Aug 2013 17:02:58 GMT
Author: joyce
Date: Fri Aug 16 17:02:58 2013
New Revision: 1514789

URL: http://svn.apache.org/r1514789
Log:
CLIMATE-256 - Update Evaluation tests for new Bounds related code.

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

Modified: incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py?rev=1514789&r1=1514788&r2=1514789&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py Fri Aug 16 17:02:58
2013
@@ -20,7 +20,7 @@
 import unittest
 import numpy as np
 import datetime as dt
-from ocw.dataset import Dataset
+from ocw.dataset import Dataset, Bounds
 from ocw.evaluation import Evaluation
 from ocw.metrics import Bias, TemporalStdDev
 
@@ -63,6 +63,21 @@ class TestEvaluation(unittest.TestCase):
         # TemporalStdDev is a "unary" metric and should be stored as such
         self.assertEqual(len(self.eval.unary_metrics), 1)
 
+    def test_valid_subregion(self):
+        bound = Bounds(
+                -10, 10, 
+                -20, 20, 
+                dt.datetime(2000, 1, 1), dt.datetime(2001, 1, 1))
+
+        self.eval.subregions = [bound, bound]
+        self.assertEquals(len(self.eval.subregions), 2)
+
+    def test_invalid_subregion_bound(self):
+        bound = "This is not a bounds object"
+
+        with self.assertRaises(ValueError):
+            self.eval.subregions = [bound]
+
     def test_add_ref_dataset(self):
         self.eval = Evaluation(self.test_dataset, [], [])
 



Mime
View raw message