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

scipy-svn at scipy.org scipy-svn at scipy.org
Tue Jan 30 14:39:49 CST 2007


Author: mattknox_ca
Date: 2007-01-30 14:39:45 -0600 (Tue, 30 Jan 2007)
New Revision: 2651

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

Modified: trunk/Lib/sandbox/timeseries/tests/test_timeseries.py
===================================================================
--- trunk/Lib/sandbox/timeseries/tests/test_timeseries.py	2007-01-30 20:30:38 UTC (rev 2650)
+++ trunk/Lib/sandbox/timeseries/tests/test_timeseries.py	2007-01-30 20:39:45 UTC (rev 2651)
@@ -27,9 +27,9 @@
 
 from timeseries import tseries
 #reload(tseries)
-from timeseries.tseries import Date, date_array_fromlist
+from timeseries.tseries import Date, date_array_fromlist, date_array
 from timeseries.tseries import time_series, TimeSeries, adjust_endpoints, \
-    mask_period, align_series
+    mask_period, align_series, fill_missing_dates
 
 class test_creation(NumpyTestCase):
     "Base test class for MaskedArrays."
@@ -334,6 +334,22 @@
                      Date(freq='b', year=2005, month=6, day=1).asfreq('M'))
         assert_equal(highToLow.end_date,
                      (Date(freq='b', year=2005, month=6, day=1) + 99).asfreq('M'))
+                     
+    def test_fill_missing_dates(self):
+        """Test fill_missing_dates function"""
+        
+        _start = Date(freq='m', year=2005, month=1)
+        _end = Date(freq='m', year=2005, month=4)
+        
+        dates = date_array([_start, _end], freq='M')
+        series = time_series([1, 2], dates)
+        filled_ser = fill_missing_dates(series)
+        
+        assert_equal(filled_ser.start_date, _start)
+        assert_equal(filled_ser.end_date, _end)
+        assert(filled_ser.isfull())
+        assert(not filled_ser.has_duplicated_dates())
+        assert_equal(filled_ser.size, _end - _start + 1)
     
     #
     def test_maskperiod(self):        



More information about the Scipy-svn mailing list