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 19:02:58 UTC

svn commit: r1514789 - /incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py

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, [], [])