climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1562275 - /incubator/climate/trunk/ocw/tests/test_utils.py
Date Tue, 28 Jan 2014 22:20:11 GMT
Author: joyce
Date: Tue Jan 28 22:20:11 2014
New Revision: 1562275

URL: http://svn.apache.org/r1562275
Log:
CLIMATE-329 - Add valid time decoding test.

Modified:
    incubator/climate/trunk/ocw/tests/test_utils.py

Modified: incubator/climate/trunk/ocw/tests/test_utils.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/tests/test_utils.py?rev=1562275&r1=1562274&r2=1562275&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/tests/test_utils.py (original)
+++ incubator/climate/trunk/ocw/tests/test_utils.py Tue Jan 28 22:20:11 2014
@@ -25,7 +25,7 @@ import netCDF4
 import ocw.utils as utils
 
 class TestDecodeTimes(unittest.TestCase):
-    test_model = "../ocw-ui/backend/tests/example_data/lat_lon_time.nc"
+    test_model = '../ocw-ui/backend/tests/example_data/lat_lon_time.nc'
 
     def setUp(self):
         self.netcdf = netCDF4.Dataset(os.path.abspath(self.test_model), mode='r')
@@ -35,5 +35,13 @@ class TestDecodeTimes(unittest.TestCase)
 
         self.assertTrue(all([type(x) is datetime.datetime for x in times]))
 
+    def test_valid_time_processing(self):
+        start_time = datetime.datetime.strptime('1988-06-10 00:00:00', '%Y-%m-%d %H:%M:%S')
+        end_time = datetime.datetime.strptime('2008-01-27 00:00:00', '%Y-%m-%d %H:%M:%S')
+        times = utils.decode_time_values(self.netcdf, 'time')
+
+        self.assertEquals(times[0], start_time)
+        self.assertEquals(times[-1], end_time)
+
 if __name__ == '__main__':
     unittest.main()



Mime
View raw message