You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by bo...@apache.org on 2013/08/13 00:14:18 UTC

svn commit: r1513279 - /incubator/climate/branches/RefactorInput/ocw/tests/test_local.py

Author: boustani
Date: Mon Aug 12 22:14:18 2013
New Revision: 1513279

URL: http://svn.apache.org/r1513279
Log:
test for load_file() function in local.py

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

Modified: incubator/climate/branches/RefactorInput/ocw/tests/test_local.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/tests/test_local.py?rev=1513279&r1=1513278&r2=1513279&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_local.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_local.py Mon Aug 12 22:14:18 2013
@@ -24,7 +24,7 @@ import datetime
 from data_source.local import *
 
 
-class test_load_ile(unittest.TestCase):
+class test_load_file(unittest.TestCase):
 
 
     def setUp(self):
@@ -109,11 +109,26 @@ class test_load_ile(unittest.TestCase):
         newTimes = datetime(2001,01,01), datetime(2001,02,01), datetime(2001,03,01)
         self.assertItemsEqual(calculate_time(self.netCDF_file, self.times, self.variable_name_list[2]), newTimes)
 
-'''
-    def test_function_load_file(self):
-        print self.file_path
-        self.assertEqual(load_file('/Users/Mboustani/Documents/python/program/ocw2/temporaryNetcdf.nc', None), Dataset())
-'''
+
+    def test_function_load_file_lats(self):
+        '''To test load_file function for latitudes'''
+        self.assertItemsEqual(load_file('/Users/Mboustani/Documents/python/program/ocw2/temporaryNetcdf.nc', None).lats, self.latitudes)
+
+
+    def test_function_load_file_lons(self):
+        '''To test load_file function for longitudes'''
+        self.assertItemsEqual(load_file('/Users/Mboustani/Documents/python/program/ocw2/temporaryNetcdf.nc', None).lons, self.longitudes)
+
+
+    def test_function_load_file_times(self):
+        '''To test load_file function for times'''
+        newTimes = datetime(2001,01,01), datetime(2001,02,01), datetime(2001,03,01)
+        self.assertItemsEqual(load_file('/Users/Mboustani/Documents/python/program/ocw2/temporaryNetcdf.nc', None).times, newTimes)
+
+
+    def test_function_load_file_values(self):
+        '''To test load_file function for values'''
+        self.assertTrue(numpy.allclose(load_file('/Users/Mboustani/Documents/python/program/ocw2/temporaryNetcdf.nc', None).values, self.values))
 
 
 if __name__ == '__main__':