示例#1
0
 def test_check_overlapping_times_overlap_on_end_date(self):
     d1_start = datetime.strptime('2013-11-01', '%Y-%m-%d')
     d1_end = datetime.strptime('2014-01-01', '%Y-%m-%d')
     d2_start = datetime.strptime('2013-10-01', '%Y-%m-%d')
     d2_end = datetime.strptime('2013-12-01', '%Y-%m-%d')
     dates_emp1 = (d1_start, d1_end)
     dates_emp2 = (d2_start, d2_end)
     expected_overlap = 31
     self.assertEqual(
         expected_overlap,
         solution_sirma._calculate_overlapping_times([dates_emp1],
                                                     [dates_emp2]))
示例#2
0
 def test_check_overlapping_times_overlap_interval_contains_multiple_dates(
         self):
     interval1_start = datetime.strptime('2009-01-01', '%Y-%m-%d')
     interval1_end = datetime.strptime('2011-04-01', '%Y-%m-%d')
     interval2_start1 = datetime.strptime('2011-03-01', '%Y-%m-%d')
     interval2_end1 = datetime.strptime('2011-04-27', '%Y-%m-%d')
     interval2_start2 = datetime.strptime('2014-01-01', '%Y-%m-%d')
     interval2_end2 = datetime.strptime('2015-04-27', '%Y-%m-%d')
     dates_emp1 = [(interval1_start, interval1_end)]
     dates_emp2 = [(interval2_start1, interval2_end1),
                   (interval2_start2, interval2_end2)]
     expected_overlap = 32
     self.assertEqual(
         expected_overlap,
         solution_sirma._calculate_overlapping_times(
             dates_emp1, dates_emp2))