Exemple #1
0
 def test_find_gap_day_no_gap(self):
     self.assertEqual([],
                      find_gaps(self.files_day,
                                frequency=Frequency(
                                    value=1,
                                    unit=Frequency.UNIT.DAY,
                                    frequency_type=Frequency.TYPE.EVERY)))
Exemple #2
0
 def test_find_gap_day(self):
     gap = find_gaps(self.files_day_gap,
                     frequency=Frequency(
                         value=1,
                         unit=Frequency.UNIT.DAY,
                         frequency_type=Frequency.TYPE.EVERY))
     self.assertEqual(len(gap), 19)
Exemple #3
0
 def test_find_gap_months_per(self):
     self.assertEqual([],
                      find_gaps(self.files_months,
                                frequency=Frequency(
                                    value=1,
                                    unit=Frequency.UNIT.MONTH,
                                    frequency_type=Frequency.TYPE.PER)))
Exemple #4
0
 def test_find_gap_minutes(self):
     self.assertEqual([],
                      find_gaps(self.files_15minutes,
                                frequency=Frequency(
                                    value=4,
                                    unit=Frequency.UNIT.HOUR,
                                    frequency_type=Frequency.TYPE.PER)))
Exemple #5
0
 def test_find_gap_day_to(self):
     gap = find_gaps(self.files_day,
                     frequency=Frequency(
                         value=1,
                         unit=Frequency.UNIT.DAY,
                         frequency_type=Frequency.TYPE.EVERY),
                     to_date=self.to_date)
     self.assertEqual(len(gap), 3)
Exemple #6
0
 def test_find_gap_minutes_with_gap(self):
     gap = find_gaps(self.files_15minutes[:3] + self.files_15minutes[5:],
                     frequency=Frequency(value=4,
                                         unit=Frequency.UNIT.HOUR,
                                         frequency_type=Frequency.TYPE.PER))
     self.assertEqual(len(gap), 2)
     self.assertEqual(gap[0], self.files_15minutes[3])
     self.assertEqual(gap[1], self.files_15minutes[4])
Exemple #7
0
 def test_find_gap_dekad_with_gap_per(self):
     gap = find_gaps(self.files_dekad[:10] + self.files_dekad[12:],
                     frequency=Frequency(value=1,
                                         unit=Frequency.UNIT.DEKAD,
                                         frequency_type=Frequency.TYPE.PER))
     self.assertEqual(len(gap), 2)
     self.assertEqual(gap[0], self.files_dekad[10])
     self.assertEqual(gap[1], self.files_dekad[11])
Exemple #8
0
 def test_find_gap_dekad_no_gap_per(self):
     self.assertEqual([],
                      find_gaps(self.files_dekad,
                                frequency=Frequency(
                                    dateformat='YYYYMMDD',
                                    value=1,
                                    unit=Frequency.UNIT.DEKAD,
                                    frequency_type=Frequency.TYPE.PER)))
Exemple #9
0
 def test_find_gap_dekad_intervals_no_gap(self):
     intervals = find_gaps(self.files_dekad,
                           frequency=Frequency(
                               dateformat='YYYYMMDD',
                               value=1,
                               unit=Frequency.UNIT.DEKAD,
                               frequency_type=Frequency.TYPE.EVERY),
                           only_intervals=True)
     self.assertEqual(len(intervals), 1)
     self.assertEqual(intervals[0][2], INTERVAL_TYPE.PRESENT)
Exemple #10
0
 def test_find_gap_dekad_intervals_with_gap(self):
     frequency = Frequency(value=1,
                           unit=Frequency.UNIT.DEKAD,
                           frequency_type=Frequency.TYPE.EVERY)
     intervals = find_gaps(self.files_dekad[:10] + self.files_dekad[14:],
                           frequency=frequency,
                           only_intervals=True)
     self.assertEqual(len(intervals), 3)
     self.assertEqual(intervals[0][2], INTERVAL_TYPE.PRESENT)
     self.assertEqual(intervals[1][0],
                      frequency.extract_date(self.files_dekad[10]))
     self.assertEqual(intervals[1][1],
                      frequency.extract_date(self.files_dekad[13]))
     self.assertEqual(intervals[2][2], INTERVAL_TYPE.PRESENT)
Exemple #11
0
 def test_find_gap_intervals_day(self):
     frequency = Frequency(value=1,
                           unit=Frequency.UNIT.DAY,
                           frequency_type=Frequency.TYPE.EVERY)
     intervals = find_gaps(self.files_day_gap,
                           frequency=frequency,
                           only_intervals=True)
     self.assertEqual(len(intervals), 5)
     self.assertEqual(intervals[0][2], INTERVAL_TYPE.PRESENT)
     self.assertEqual(intervals[0][0],
                      frequency.extract_date(self.files_day_gap[0]))
     self.assertEqual(intervals[0][1],
                      frequency.extract_date(self.files_day_gap[0]))
     self.assertEqual(intervals[1][2], INTERVAL_TYPE.MISSING)
     self.assertEqual(intervals[2][2], INTERVAL_TYPE.PRESENT)
     self.assertEqual(intervals[3][2], INTERVAL_TYPE.MISSING)
     self.assertEqual(intervals[4][2], INTERVAL_TYPE.PRESENT)
     self.assertEqual(intervals[4][0],
                      frequency.extract_date(self.files_day_gap[-1]))
     self.assertEqual(intervals[4][1],
                      frequency.extract_date(self.files_day_gap[-1]))