'Testing calendar hours computation on a working day'

def test_30_calendar_working_days(self):

    intervals = self.calendar.get_working_intervals_of_day(start_dt=self.date1.replace(hour=10, minute=30, second=0))
    self.assertEqual(len(intervals), 1, 'resource_calendar:    wrong    working    interval    /    day    computing')
    self.assertEqual(intervals[0][0], Datetime.from_string('2013-02-12    10:30:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    self.assertEqual(intervals[0][1], Datetime.from_string('2013-02-12    16:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    wh = self.calendar.get_working_hours_of_date(start_dt=self.date1.replace(hour=10, minute=30, second=0))
    self.assertEqual(wh, 5.5, 'resource_calendar:    wrong    working    interval    /    day    time    computing')
    intervals = self.calendar.get_working_intervals_of_day(start_dt=(self.date1.replace(hour=7, minute=0, second=0) + relativedelta(days=7)))
    self.assertEqual(len(intervals), 1, 'resource_calendar:    wrong    working    interval/day    computing')
    self.assertEqual(intervals[0][0], Datetime.from_string('2013-02-19    08:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    self.assertEqual(intervals[0][1], Datetime.from_string('2013-02-19    16:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    intervals = self.calendar.get_working_intervals_of_day(start_dt=(self.date1.replace(hour=7, minute=0, second=0) + relativedelta(days=7)), compute_leaves=True)
    self.assertEqual(len(intervals), 2, 'resource_calendar:    wrong    working    interval/day    computing')
    self.assertEqual(intervals[0][0], Datetime.from_string('2013-02-19    08:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    self.assertEqual(intervals[0][1], Datetime.from_string('2013-02-19    09:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    self.assertEqual(intervals[1][0], Datetime.from_string('2013-02-19    12:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    self.assertEqual(intervals[1][1], Datetime.from_string('2013-02-19    16:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    intervals = self.calendar.get_working_intervals_of_day(start_dt=(self.date1.replace(hour=7, minute=0, second=0) + relativedelta(days=14)), compute_leaves=True)
    self.assertEqual(len(intervals), 1, 'resource_calendar:    wrong    working    interval/day    computing')
    self.assertEqual(intervals[0][0], Datetime.from_string('2013-02-26    08:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    self.assertEqual(intervals[0][1], Datetime.from_string('2013-02-26    16:00:00'), 'resource_calendar:    wrong    working    interval    /    day    computing')
    intervals = self.calendar.get_working_intervals_of_day(start_dt=(self.date1.replace(hour=7, minute=0, second=0) + relativedelta(days=14)), compute_leaves=True, resource_id=self.resource1_id)
    self.assertEqual(len(intervals), 0, 'resource_calendar:    wrong    working    interval/day    computing')
