Esempio n. 1
0
    def test_days_with_single_start_and_end_time(self):
        day = [new_workinghours('8:15', '16:45')]
        estimated_hours = hours_estimator.estimate_hours(day)

        assert estimated_hours.start == datetime.time(8, 15)
        assert estimated_hours.end == datetime.time(16, 45)
        assert len(estimated_hours.potential_start) == 1
        assert len(estimated_hours.potential_end) == 1
    def test_should_return_start_and_end_times_even_when_they_are_not_in_office_hours(self):
        hours_in_day = [new_workinghours('10:00', '14:00'), new_workinghours('21:00', '22:00')]
        estimated_hours = hours_estimator.estimate_hours(hours_in_day)

        assert estimated_hours.start == datetime.time(10, 00)
        assert estimated_hours.end == datetime.time(22, 00)
        assert len(estimated_hours.potential_start) == 2
        assert len(estimated_hours.potential_end) == 2
    def test_should_use_hours_closest_to_office_hours_for_start_times(self):
        hours_in_day = [new_workinghours('6:00', '7:30'), new_workinghours('7:45', '17:00')]
        estimated_hours = hours_estimator.estimate_hours(hours_in_day)

        assert estimated_hours.start == datetime.time(7, 45)
        assert estimated_hours.end == datetime.time(17, 00)
        assert len(estimated_hours.potential_start) == 2
        assert len(estimated_hours.potential_end) == 2
    def test_days_with_2_start_and_end_times_select_closest_to_office_hours(self):
        hours_in_day = [new_workinghours('8:00', '17:00'), new_workinghours('20:00', '21:00')]
        estimated_hours = hours_estimator.estimate_hours(hours_in_day)

        assert estimated_hours.start == datetime.time(8, 00)
        assert estimated_hours.end == datetime.time(17, 00)
        assert len(estimated_hours.potential_start) == 2
        assert len(estimated_hours.potential_end) == 2
    def test_days_with_single_start_and_end_time(self):
        day = [new_workinghours('8:15', '16:45')]
        estimated_hours = hours_estimator.estimate_hours(day)

        assert estimated_hours.start == datetime.time(8 , 15)
        assert estimated_hours.end == datetime.time(16, 45)
        assert len(estimated_hours.potential_start) == 1
        assert len(estimated_hours.potential_end) == 1
Esempio n. 6
0
def print_hours(days):
    weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
    
    for day in days:
        date = day[0].date
        print '\n%s, %s: Options: %i' % (date, weekdays[date.weekday()], len(day))
        estimate = hours_estimator.estimate_hours(day)
        print 'Estimation: %s' % estimate
        for hours in day:
            print '\t %s %s' % (hours.start, hours.end)
Esempio n. 7
0
    def test_should_use_hours_closest_to_office_hours_for_start_times(self):
        hours_in_day = [
            new_workinghours('6:00', '7:30'),
            new_workinghours('7:45', '17:00')
        ]
        estimated_hours = hours_estimator.estimate_hours(hours_in_day)

        assert estimated_hours.start == datetime.time(7, 45)
        assert estimated_hours.end == datetime.time(17, 00)
        assert len(estimated_hours.potential_start) == 2
        assert len(estimated_hours.potential_end) == 2
Esempio n. 8
0
    def test_should_return_start_and_end_times_even_when_they_are_not_in_office_hours(
            self):
        hours_in_day = [
            new_workinghours('10:00', '14:00'),
            new_workinghours('21:00', '22:00')
        ]
        estimated_hours = hours_estimator.estimate_hours(hours_in_day)

        assert estimated_hours.start == datetime.time(10, 00)
        assert estimated_hours.end == datetime.time(22, 00)
        assert len(estimated_hours.potential_start) == 2
        assert len(estimated_hours.potential_end) == 2
Esempio n. 9
0
    def test_days_with_2_start_and_end_times_select_closest_to_office_hours(
            self):
        hours_in_day = [
            new_workinghours('8:00', '17:00'),
            new_workinghours('20:00', '21:00')
        ]
        estimated_hours = hours_estimator.estimate_hours(hours_in_day)

        assert estimated_hours.start == datetime.time(8, 00)
        assert estimated_hours.end == datetime.time(17, 00)
        assert len(estimated_hours.potential_start) == 2
        assert len(estimated_hours.potential_end) == 2
Esempio n. 10
0
def print_hours(days):
    weekdays = [
        'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
        'Sunday'
    ]

    for day in days:
        date = day[0].date
        print '\n%s, %s: Options: %i' % (date, weekdays[date.weekday()],
                                         len(day))
        estimate = hours_estimator.estimate_hours(day)
        print 'Estimation: %s' % estimate
        for hours in day:
            print '\t %s %s' % (hours.start, hours.end)