def test_instructor_hours(): gc = Gym("Gold Ring") diane = Instructor(1, 'Diane') roney = Instructor(2, 'Roney') diane.add_certificate('Strength Training') diane.add_certificate('Interval Training') diane.add_certificate('Long Runs') diane.add_certificate('Tempo') diane.add_certificate('FTP Test') roney.add_certificate('Strength Training') roney.add_certificate('Interval Training') roney.add_certificate('Tempo') workout_class_run = WorkoutClass('Running', [ 'Strength Training', 'Interval Training', 'Long Runs', 'Tempo', 'FTP Test' ]) workout_class_cycling = WorkoutClass( 'Cycling Basics', ['Strength Training', 'Interval Training', 'Tempo']) gc.add_workout_class(workout_class_run) gc.add_workout_class(workout_class_cycling) gc.add_instructor(diane) gc.add_instructor(roney) JAN_27_2020 = datetime(2020, 1, 27, 12, 0) JAN_28_2020 = datetime(2020, 1, 28, 12, 0) assert gc.instructor_hours(JAN_27_2020, JAN_28_2020) == {1: 0, 2: 0} gc.add_room('Cycling Room', 1) gc.add_room('Strength Room', 1) gc.schedule_workout_class(JAN_27_2020, 'Strength Room', workout_class_run.get_name(), diane.get_id()) gc.schedule_workout_class(JAN_27_2020, 'Cycling Room', workout_class_cycling.get_name(), roney.get_id()) assert gc.instructor_hours(JAN_27_2020, JAN_28_2020) == {1: 1, 2: 1} gc.schedule_workout_class(JAN_28_2020, 'Strength Room', workout_class_run.get_name(), diane.get_id()) assert gc.instructor_hours(JAN_27_2020, JAN_28_2020) == {1: 2, 2: 1}
def test_gym_instr_hours_everything() -> None: ac = Gym('Athletic Centre') diane = Instructor(1, 'Diane') david = Instructor(2, 'David') assert diane.add_certificate('Cardio 1') assert david.add_certificate('Cardio 1') assert ac.add_instructor(diane) assert ac.add_instructor(david) assert ac.add_room('Dance Studio', 50) assert ac.add_room('Danc Studio', 50) boot_camp = WorkoutClass('Boot Camp', ['Cardio 1']) assert ac.add_workout_class(boot_camp) t1 = datetime(2019, 9, 9, 12, 0) t2 = datetime(2019, 9, 10, 12, 0) t3 = datetime(2019, 9, 8, 12, 0) t4 = datetime(2019, 9, 11, 12, 0) assert ac.instructor_hours(t1, t2) == {1: 0, 2: 0} assert ac.schedule_workout_class(t1, 'Dance Studio', boot_camp.get_name(), 1) assert ac.instructor_hours(t1, t2) == {1: 1, 2: 0} assert ac.schedule_workout_class(t2, 'Dance Studio', boot_camp.get_name(), 2) assert ac.instructor_hours(t1, t2) == {1: 1, 2: 1} assert ac.schedule_workout_class(t3, 'Dance Studio', boot_camp.get_name(), 1) assert ac.schedule_workout_class(t4, 'Dance Studio', boot_camp.get_name(), 1) assert ac.instructor_hours(t1, t2) == {1: 1, 2: 1} d = Instructor(3, 'David') assert d.add_certificate('Cardio 1') assert ac.add_instructor(d) assert ac.schedule_workout_class(t3, 'Danc Studio', boot_camp.get_name(), 3) assert ac.instructor_hours(t3, t4) == {1: 3, 2: 1, 3: 1}
def test_gym_payroll_everything() -> None: ac = Gym('Athletic Centre') diane = Instructor(1, 'Diane') david = Instructor(2, 'David') assert diane.add_certificate('Cardio 1') assert diane.add_certificate('test') assert david.add_certificate('Cardio 1') assert ac.add_instructor(diane) assert ac.add_instructor(david) assert ac.add_room('Dance Studio', 50) assert ac.add_room('Danc Studio', 50) boot_camp = WorkoutClass('Boot Camp', ['Cardio 1']) assert ac.add_workout_class(boot_camp) t1 = datetime(2019, 9, 9, 12, 0) t2 = datetime(2019, 9, 10, 12, 0) t3 = datetime(2019, 9, 8, 12, 0) t4 = datetime(2019, 9, 11, 12, 0) assert ac.payroll(t1, t2, 25.0) == [(1, 'Diane', 0, 0.0), (2, 'David', 0, 0.0)] assert ac.instructor_hours(t1, t2) == {1: 0, 2: 0} assert ac.schedule_workout_class(t1, 'Dance Studio', boot_camp.get_name(), 1) assert ac.instructor_hours(t1, t2) == {1: 1, 2: 0} assert ac.schedule_workout_class(t2, 'Dance Studio', boot_camp.get_name(), 2) assert ac.instructor_hours(t1, t2) == {1: 1, 2: 1} assert ac.schedule_workout_class(t3, 'Dance Studio', boot_camp.get_name(), 1) assert ac.schedule_workout_class(t4, 'Dance Studio', boot_camp.get_name(), 1) assert ac.instructor_hours(t1, t2) == {1: 1, 2: 1} assert ac.payroll(t1, t2, 25.0) == [(1, 'Diane', 1, 28.0), (2, 'David', 1, 26.5)] assert diane.add_certificate('tst') assert diane.add_certificate('tet') assert ac.payroll(t1, t2, 25.0) == [(1, 'Diane', 1, 31.0), (2, 'David', 1, 26.5)] d = Instructor(5, 'Davi') assert d.add_certificate('Cardio 1') assert ac.add_instructor(d) assert ac.schedule_workout_class(t3, 'Danc Studio', boot_camp.get_name(), 5) assert ac.instructor_hours(t3, t4) == {1: 3, 2: 1, 5: 1} assert ac.payroll(t3, t4, 25.0) == [(1, 'Diane', 3, 93.0), (2, 'David', 1, 26.5), (5, 'Davi', 1, 26.5)] e = Instructor(4, 'Dav') assert e.add_certificate('Cardio 1') assert e.add_certificate('Cardio') assert ac.add_instructor(e) assert ac.schedule_workout_class(t4, 'Danc Studio', boot_camp.get_name(), 4) assert ac.payroll(t3, t4, 25.0) == [(1, 'Diane', 3, 93.0), (2, 'David', 1, 26.5), (4, 'Dav', 1, 28.0), (5, 'Davi', 1, 26.5)]
def test_instructor_hours_two_people_mixed_hours_JEN() -> None: ac = Gym('Athletic Centre') instructor = Instructor(5, 'Matthew') instructor2 = Instructor(12, 'Jennifer') swimming = WorkoutClass('Swimming', []) jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0) jan_28_2020_12_00 = datetime(2020, 1, 29, 12, 0) assert ac.add_workout_class(swimming) assert ac.add_instructor(instructor) assert ac.add_instructor(instructor2) assert ac.add_room('25-yard Pool', 100) assert ac.schedule_workout_class(jan_28_2020_11_00, '25-yard Pool', swimming.get_name(), instructor.get_id()) assert ac.schedule_workout_class(jan_28_2020_12_00, '25-yard Pool', swimming.get_name(), instructor.get_id()) t1 = datetime(2020, 1, 29, 11, 0) t2 = datetime(2020, 1, 29, 12, 0) assert ac.instructor_hours(t1, t2) == {5: 2, 12: 0}