climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [2/3] climate git commit: tests for subset name
Date Wed, 18 Mar 2015 16:53:31 GMT
tests for subset name


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/0cf03df0
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/0cf03df0
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/0cf03df0

Branch: refs/heads/master
Commit: 0cf03df0fc1f829e42a418f19baafec22393aaf3
Parents: e2718cb
Author: Kim Whitehall <k_whitehall@yahoo.com>
Authored: Mon Mar 16 10:45:48 2015 -0700
Committer: Kim Whitehall <k_whitehall@yahoo.com>
Committed: Mon Mar 16 14:12:57 2015 -0700

----------------------------------------------------------------------
 ocw/tests/test_dataset_processor.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/0cf03df0/ocw/tests/test_dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/tests/test_dataset_processor.py b/ocw/tests/test_dataset_processor.py
index 88641bc..9cb60ce 100644
--- a/ocw/tests/test_dataset_processor.py
+++ b/ocw/tests/test_dataset_processor.py
@@ -174,6 +174,7 @@ class TestNormalizeDatasetDatetimes(unittest.TestCase):
 class TestSubset(unittest.TestCase):
     def setUp(self):
         self.target_dataset = ten_year_monthly_dataset()
+        self.name = 'foo'
 
         self.subregion = ds.Bounds(
             -81, 81, 
@@ -202,7 +203,16 @@ class TestSubset(unittest.TestCase):
         self.assertEqual(subset.lons.shape[0], 162)
         self.assertEqual(subset.times.shape[0], 37)
         self.assertEqual(subset.values.shape, (37, 82, 162))
-    
+
+    def test_subset_name(self):
+        subset = dp.subset(self.subregion, self.target_dataset)
+        self.assertEqual(subset.name, self.name)
+
+    def test_subset_name_propagation(self):
+        subset_name = 'foo_subset_name'
+        subset = dp.subset(self.subregion, self.target_dataset,subset_name)
+        self.assertEqual(subset.name, subset_name)
+
     def test_subset_using_non_exact_spatial_bounds(self):
         index_slices = dp._get_subregion_slice_indices(self.non_exact_spatial_subregion,
 self.target_dataset)
         control_index_slices = {"lat_start"  : 5,


Mime
View raw message