@@ -323,7 +323,7 @@ def test_update_multi_partial_days_data(self):
323323 self .assertEqual (store .time_interval , 300 )
324324 self .assertEqual (store .shape_x , 288 )
325325
326- key = '999 '
326+ key = '9991 '
327327 path = os .path .dirname (os .path .realpath (__file__ ))
328328 data = np .load (os .path .join (path , '005.npy' ))
329329
@@ -337,6 +337,25 @@ def test_update_multi_partial_days_data(self):
337337 y2 = store .get (key , date )
338338 np .testing .assert_array_equal (y2 [206 ], data [- 1 ])
339339
340+ def test_update_multi_hold_data (self ):
341+ market_minutes = 1440 # 5min data
342+ store = FiveMinute (h5py .File ('%s/data.h5' % helper .datadir ),
343+ market_minutes )
344+ key = '9992'
345+ path = os .path .dirname (os .path .realpath (__file__ ))
346+ data = np .load (os .path .join (path , '005_na.npy' ))
347+
348+ store .update (key , data )
349+
350+ date = datetime .fromtimestamp (data [- 1 ]['time' ]).date ()
351+ y2 = store .get (key , date )
352+
353+ # Data has holes between index 171 and index 172.
354+ np .testing .assert_array_equal (y2 [0 ], data [132 ])
355+ np .testing .assert_array_equal (y2 [167 ], data [- 1 ])
356+ np .testing .assert_array_equal (y2 [39 ], data [171 ])
357+ np .testing .assert_array_equal (y2 [43 ], data [172 ])
358+
340359
341360class MinuteSnapshotCacheTest (unittest .TestCase ):
342361
0 commit comments