def test_total_hours_to_work_no_holidays_no_weekend(): start = datetime(2018, 3, 6) end = datetime(2018, 3, 8) r = Recorder() actual_result = r.total_hours_to_work(start, end) expected_result = 3 * 7.5 assert expected_result == actual_result
def test_total_hours_to_work_with_holidays_and_weekend(): start = datetime(2018, 3, 28) end = datetime(2018, 4, 4) bh = create_bank_holiday(date=datetime(2018, 4, 2)) # Easter Monday ph = create_personal_holiday(date=datetime(2018, 4, 3)) # Easter Monday r = Recorder() r.add(bh) r.add(ph) actual_result = r.total_hours_to_work(start, end) # 8 real days - (2 weekend days + 1 bank holiday + 1 personal holiday) expected_result = (8 - (2 + 1 + 1)) * 7.5 assert expected_result == actual_result