'Testing working intervals computing method of resource.calendar'

def test_20_calendar_working_intervals(self):

    intervals = self.calendar.get_working_intervals_of_day(start_dt=self.date1)
    self.assertEqual(len(intervals), 1, 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[0][0], Datetime.from_string('2013-02-12    09:08:07'), 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[0][1], Datetime.from_string('2013-02-12    16:00:00'), 'resource_calendar:    wrong    working    intervals')
    intervals = self.calendar.get_working_intervals_of_day(start_dt=self.date2)
    self.assertEqual(len(intervals), 2, 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[0][0], Datetime.from_string('2013-02-15    10:11:12'), 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[0][1], Datetime.from_string('2013-02-15    13:00:00'), 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[1][0], Datetime.from_string('2013-02-15    16:00:00'), 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[1][1], Datetime.from_string('2013-02-15    23:00:00'), 'resource_calendar:    wrong    working    intervals')
    intervals = self.calendar.get_working_intervals_of_day(start_dt=self.date1.replace(hour=0), compute_leaves=True)
    self.assertEqual(len(intervals), 1, 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[0][0], Datetime.from_string('2013-02-12    08:00:00'), 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[0][1], Datetime.from_string('2013-02-12    16:00:00'), 'resource_calendar:    wrong    working    intervals')
    intervals = self.calendar.get_working_intervals_of_day(start_dt=(self.date1.replace(hour=8) + relativedelta(days=7)), end_dt=(self.date1.replace(hour=15, minute=45, second=30) + relativedelta(days=7)), compute_leaves=True)
    self.assertEqual(len(intervals), 2, 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[0][0], Datetime.from_string('2013-02-19    08:08:07'), 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[0][1], Datetime.from_string('2013-02-19    09:00:00'), 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[1][0], Datetime.from_string('2013-02-19    12:00:00'), 'resource_calendar:    wrong    working    intervals')
    self.assertEqual(intervals[1][1], Datetime.from_string('2013-02-19    15:45:30'), 'resource_calendar:    wrong    working    intervals')
