Пример #1
0
 def test_days_future_range(self):
     unit = 'days'
     range_from = 0
     range_to = 2
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  4,  3,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  4,  5, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #2
0
 def test_months_past_range(self):
     unit = 'months'
     range_from = -4
     range_to = -1
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2016, 12,  1,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  3, 31, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #3
0
 def test_weeks_span_range(self):
     unit = 'weeks'
     range_from = -1
     range_to = 2
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  3, 26,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  4, 22, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #4
0
 def test_years_single(self):
     unit = 'years'
     range_from = -1
     range_to = -1
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2016,  1,  1,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2016, 12, 31, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #5
0
 def test_hours_past_range(self):
     unit = 'hours'
     range_from = -3
     range_to = -1
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  4,  3, 19,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  4,  3, 21, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #6
0
 def test_months_span_range(self):
     unit = 'months'
     range_from = -1
     range_to = 2
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  3,  1,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  6, 30, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #7
0
 def test_months_super_future_range(self):
     unit = 'months'
     range_from = 9
     range_to = 10
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2018,  1,  1,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2018,  2, 28, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #8
0
 def test_months_super_future_range(self):
     unit = 'months'
     range_from = 9
     range_to = 10
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2018,  1,  1,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2018,  2, 28, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #9
0
 def test_weeks_future_range(self):
     unit = 'weeks'
     range_from = 0
     range_to = 2
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  4,  2, 00,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  4, 22, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #10
0
 def test_weeks_single(self):
     unit = 'weeks'
     range_from = -1
     range_to = -1
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  3, 26,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  4,  1, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #11
0
 def test_days_past_range(self):
     unit = 'days'
     range_from = -3
     range_to = -1
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  3, 31,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  4,  2, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch))
Пример #12
0
 def test_weeks_future_range_iso(self):
     unit = 'weeks'
     range_from = 0
     range_to = 2
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  4,  3,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  4, 23, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch, 
             week_starts_on='monday')
     )
Пример #13
0
 def test_weeks_span_range_iso(self):
     unit = 'weeks'
     range_from = -1
     range_to = 2
     epoch = curator.datetime_to_epoch(datetime(2017,  4,  3, 22, 50, 17))
     start = curator.datetime_to_epoch(datetime(2017,  3, 27,  0,  0,  0))
     end   = curator.datetime_to_epoch(datetime(2017,  4, 23, 23, 59, 59))
     self.assertEqual((start,end), 
         curator.date_range(unit, range_from, range_to, epoch=epoch, 
             week_starts_on='monday')
     )