climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boust...@apache.org
Subject svn commit: r1516187 - /incubator/climate/branches/RefactorInput/ocw/tests/test_local.py
Date Wed, 21 Aug 2013 15:29:20 GMT
Author: boustani
Date: Wed Aug 21 15:29:20 2013
New Revision: 1516187

URL: http://svn.apache.org/r1516187
Log:
test for local.py now supports the changes in local.py such as testing values in 3D array.
Also all the tests for functions that are not public have been removed. More test options
will come soon.

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=1516187&r1=1516186&r2=1516187&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_local.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_local.py Wed Aug 21 15:29:20 2013
@@ -43,10 +43,10 @@ class test_load_file(unittest.TestCase):
         levels = netCDF_file.createVariable('level', 'd', ('level_dim',))
         values = netCDF_file.createVariable('value', 'd', ('level_dim', 'time_dim', 'lat_dim',
'lon_dim'))
         #To latitudes and longitudes for five values
-        self.latitudes = [i for i in range(0,5)]
-        self.longitudes = [i for i in range(200,205)]
+        self.latitudes = range(0,5)
+        self.longitudes = range(200,205)
         #Three months of data
-        self.times = [month for month in range(3)]
+        self.times = range(3)
         #Two levels
         self.levels = [100, 200]
         #Create 150 values
@@ -74,42 +74,6 @@ class test_load_file(unittest.TestCase):
         os.remove(self.file_path)
 
 
-    def test_function_get_lat_name(self):
-        '''To test get_lat_name function'''
-        self.assertItemsEqual(get_lat_name(self.variable_name_list), self.variable_name_list[0])
-
-
-    def test_function_get_lon_name(self):
-        '''To test get_lon_name function'''
-        self.assertItemsEqual(get_lon_name(self.variable_name_list), self.variable_name_list[1])
-
-
-    def test_function_get_time_name(self):
-        '''To test get_time_name function'''
-        self.assertItemsEqual(get_time_name(self.variable_name_list), self.variable_name_list[2])
-
-
-    def test_function_get_level_name(self):
-        '''To test get_level_name function'''
-        self.assertItemsEqual(get_level_name(self.variable_name_list), self.variable_name_list[3])
-
-
-    def test_function_get_time_step(self):
-        '''To test get_time_step function'''
-        self.assertItemsEqual(get_time_step(self.netCDF_file, self.variable_name_list[2]),
('months', 'months since 2001-01-01 00:00:00', 12))
-
-
-    def test_function_get_time_base(self):
-        '''To test get_time_base function'''
-        self.assertEqual(get_time_base('months since 2001-01-01 00:00:00', 12), datetime(2001,01,01))
-
-
-    def test_function_calculate_time(self):
-        '''To test calculate_time function'''
-        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_lats(self):
         '''To test load_file function for latitudes'''
         self.assertItemsEqual(load_file(self.file_path, None).lats, self.latitudes)
@@ -128,7 +92,8 @@ class test_load_file(unittest.TestCase):
 
     def test_function_load_file_values(self):
         '''To test load_file function for values'''
-        self.assertTrue(numpy.allclose(load_file(self.file_path, None).values, self.values))
+        new_values = self.values[0,:,:,:]
+        self.assertTrue(numpy.allclose(load_file(self.file_path, None).values, new_values))
 
 
 if __name__ == '__main__':



Mime
View raw message