Exemplo n.º 1
0
 def test_zero_fill_time_series_date(self):
     result = zh.zero_fill_time_series(
         self.zarkov_data['a']['a1'], 'date',
         datetime(2010, 5, 1), datetime(2011, 9, 1))
     self.assertEqual(len(result), 489)
     days_ms = 24 * 3600 * 1000
     for p1, p2 in zip(result, result[1:]):
         delta = p2[0]-p1[0]
         assert delta == days_ms
Exemplo n.º 2
0
 def test_zero_fill_time_series_month(self):
     result = zh.zero_fill_time_series(
         self.zarkov_data['a']['a1'], 'month',
         datetime(2010, 5, 1), datetime(2011, 9, 1))
     self.assertEqual(result[0][1], 0)
     self.assertEqual(result[-1][1], 0)
     self.assertEqual(len(result), 17)
     self.assertEqual(result[1][1], 1000)
     self.assertEqual(result[-3][1], 1000)
     days_ms = 24 * 3600 * 1000
     min_delta = 28 * days_ms
     max_delta= 31 * days_ms
     for p1, p2 in zip(result, result[1:]):
         delta = p2[0]-p1[0]
         assert min_delta <= delta <= max_delta, delta