climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1506187 - /incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py
Date Tue, 23 Jul 2013 17:49:38 GMT
Author: joyce
Date: Tue Jul 23 17:49:37 2013
New Revision: 1506187

URL: http://svn.apache.org/r1506187
Log:
CLIMATE-214 - Add add_metrics test for Evaluation

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=1506187&r1=1506186&r2=1506187&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py Tue Jul 23 17:49:37
2013
@@ -27,49 +27,32 @@ class TestEvaluation(unittest.TestCase):
     def setUp(self):
         self.eval = Evaluation()
 
-    def test_init(self):
-        self.assertEquals(self.eval.ref_dataset, None)
-        self.assertEquals(self.eval.target_datasets, [])
-        self.assertEquals(self.eval.metrics, [])
-
-    def test_add_ref_dataset(self):
-        # Create an example dataset to add
         lat = np.array([10, 12, 14, 16, 18])
         lon = np.array([100, 102, 104, 106, 108])
         time = np.array([dt.datetime(2000, x, 1) for x in range(1, 13)])
         flat_array = np.array(range(300))
         value = flat_array.reshape(12, 5, 5)
         variable = 'prec'
+        other_var = 'temp'
         test_dataset = Dataset(lat, lon, time, value, variable)
+        another_test_dataset = Dataset(lat, lon, time, value, other_var)
 
+    def test_init(self):
+        self.assertEquals(self.eval.ref_dataset, None)
+        self.assertEquals(self.eval.target_datasets, [])
+        self.assertEquals(self.eval.metrics, [])
+
+    def test_add_ref_dataset(self):
         self.eval.add_ref_dataset(test_dataset)
 
-        self.assertEqual(self.eval.ref_dataset.variable, 'prec')
+        self.assertEqual(self.eval.ref_dataset.variable, variable)
 
     def test_add_dataset(self):
-        lat = np.array([10, 12, 14, 16, 18])
-        lon = np.array([100, 102, 104, 106, 108])
-        time = np.array([dt.datetime(2000, x, 1) for x in range(1, 13)])
-        flat_array = np.array(range(300))
-        value = flat_array.reshape(12, 5, 5)
-        variable = 'prec'
-        test_dataset = Dataset(lat, lon, time, value, variable)
-
         self.eval.add_dataset(test_dataset)
 
-        self.assertEqual(self.eval.target_datasets[0].variable, 'prec')
+        self.assertEqual(self.eval.target_datasets[0].variable, variable)
 
     def test_add_datasets(self):
-        lat = np.array([10, 12, 14, 16, 18])
-        lon = np.array([100, 102, 104, 106, 108])
-        time = np.array([dt.datetime(2000, x, 1) for x in range(1, 13)])
-        flat_array = np.array(range(300))
-        value = flat_array.reshape(12, 5, 5)
-        variable = 'prec'
-        other_var = 'temp'
-        test_dataset = Dataset(lat, lon, time, value, variable)
-        another_test_dataset = Dataset(lat, lon, time, value, other_var)
-
         self.eval.add_datasets([test_dataset, another_test_dataset])
 
         self.assertEqual(len(self.eval.target_datasets), 2)



Mime
View raw message