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

svn commit: r1516201 - /incubator/climate/trunk/ocw/tests/test_local.py

Author: joyce
Date: Wed Aug 21 16:22:39 2013
New Revision: 1516201

URL: http://svn.apache.org/r1516201
Log:
CLIMATE-273 - Fix bad data_source.local imports

- Change the invalid import of from data_source.local import * to the
  properly pathed import ocw.data_source.local as local.
- Fix the scoping of the load_file calls so they are referenced properly
  given the changed format of the local import.
- Fix the creation of datetime objects so their calls are properly
  scoped. Now they actually work instead of crashing out.

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

Modified: incubator/climate/trunk/ocw/tests/test_local.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/tests/test_local.py?rev=1516201&r1=1516200&r2=1516201&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/tests/test_local.py (original)
+++ incubator/climate/trunk/ocw/tests/test_local.py Wed Aug 21 16:22:39 2013
@@ -21,7 +21,7 @@ import numpy.ma as ma
 import os
 import netCDF4
 import datetime
-from data_source.local import *
+import ocw.data_source.local as local
 
 
 class test_load_file(unittest.TestCase):
@@ -76,25 +76,25 @@ class test_load_file(unittest.TestCase):
 
     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)
+        self.assertItemsEqual(local.load_file(self.file_path, None).lats, self.latitudes)
 
 
     def test_function_load_file_lons(self):
         '''To test load_file function for longitudes'''
-        self.assertItemsEqual(load_file(self.file_path, None).lons, self.longitudes)
+        self.assertItemsEqual(local.load_file(self.file_path, 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(self.file_path, None).times, newTimes)
+        newTimes = datetime.datetime(2001,01,01), datetime.datetime(2001,02,01), datetime.datetime(2001,03,01)
+        self.assertItemsEqual(local.load_file(self.file_path, None).times, newTimes)
 
 
     def test_function_load_file_values(self):
         '''To test load_file function for values'''
         new_values = self.values[0,:,:,:]
-        self.assertTrue(numpy.allclose(load_file(self.file_path, None).values, new_values))
+        self.assertTrue(numpy.allclose(local.load_file(self.file_path, None).values, new_values))
 
 
 if __name__ == '__main__':
-    unittest.main()
\ No newline at end of file
+    unittest.main()