Beispiel #1
0
 def test_multiple_compress(self):
     intervals = [(datetime.date(2014, 2, 3), datetime.date(2014, 3, 10)),
                  (datetime.date(2014, 3, 20), datetime.date(2014, 7, 1))]
     expected = [(datetime.date(2014, 2, 3), datetime.date(2014, 7, 1))]
     for num_days in 11, 12, 100, 2000:
         compressed = lifetimes.compress_intervals_days(intervals, num_days)
         self.assertEqual(expected, compressed)
Beispiel #2
0
 def test_multiple_no_compress(self):
     intervals = [(datetime.date(2014, 2, 3), datetime.date(2014, 3, 10)),
                  (datetime.date(2014, 3, 20), datetime.date(2014, 7, 1))]
     for num_days in 0, 1, 9, 10:
         compressed = lifetimes.compress_intervals_days(intervals, num_days)
         self.assertEqual(intervals, compressed)
Beispiel #3
0
 def test_single_open(self):
     intervals = [(datetime.date(2014, 2, 3), None)]
     compressed = lifetimes.compress_intervals_days(intervals, 10)
     self.assertEqual(intervals, compressed)
     compressed = lifetimes.compress_intervals_days(intervals, 100)
     self.assertEqual(intervals, compressed)