[Scipy-svn] r2630 - trunk/Lib/sandbox/timeseries/tests

scipy-svn at scipy.org scipy-svn at scipy.org
Mon Jan 29 15:01:40 CST 2007


Author: mattknox_ca
Date: 2007-01-29 15:01:36 -0600 (Mon, 29 Jan 2007)
New Revision: 2630

Modified:
   trunk/Lib/sandbox/timeseries/tests/test_timeseries.py
Log:
added tests for tshift function

Modified: trunk/Lib/sandbox/timeseries/tests/test_timeseries.py
===================================================================
--- trunk/Lib/sandbox/timeseries/tests/test_timeseries.py	2007-01-29 21:00:59 UTC (rev 2629)
+++ trunk/Lib/sandbox/timeseries/tests/test_timeseries.py	2007-01-29 21:01:36 UTC (rev 2630)
@@ -276,6 +276,22 @@
         assert_equal(a.start_date, b.start_date)
         assert_equal(a.end_date, b.end_date)
         
+    def test_tshift(self):
+        "Test tshift function"
+        series = self.d[0]
+        shift_negative = series.tshift(-1)
+        result_data = [999] + [0,1,2,3,4,5,6,7,8,9,10,11,12,13]
+        result_mask = [1  ] + [1,0,0,0,0,1,0,0,0,0,1, 0, 0, 0 ]
+        shift_negative_result = time_series(result_data, series._dates, mask=result_mask)
+
+        shift_positive = series.tshift(1)
+        result_data = [1,2,3,4,5,6,7,8,9,10,11,12,13,14] + [999]
+        result_mask = [0,0,0,0,1,0,0,0,0,1, 0, 0, 0, 0 ] + [1  ]
+        shift_positive_result = time_series(result_data, series._dates, mask=result_mask)
+        
+        assert_array_equal(shift_negative, shift_negative_result)
+        assert_array_equal(shift_positive, shift_positive_result)
+        
     #
     def test_maskperiod(self):        
         "Test mask_period"



More information about the Scipy-svn mailing list