예제 #1
0
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}
예제 #2
0
def test_add_three_workouts() -> None:
    """Add three workouts to the Gym"""
    ac = Gym('Athletic Centre')
    kickboxing = WorkoutClass('Kickboxing', ['Strength Training'])
    a = WorkoutClass('b', ['Strength Training'])
    b = WorkoutClass('c', ['Strength Training'])
    assert ac.add_workout_class(kickboxing)
    assert ac.add_workout_class(a)
    assert ac.add_workout_class(b)
예제 #3
0
def test_gym_add_workout_class() -> None:
    """Test add workout class."""
    ac = Gym('Athletic Centre')
    kickboxing = WorkoutClass('Kickboxing', ['Strength Training'])
    assert ac.add_workout_class(kickboxing)
    assert ac._workouts == {'Kickboxing': kickboxing}
    assert ac.add_workout_class(kickboxing) is False

    tes = WorkoutClass('test', ['test1', 'test2', 'test3'])
    assert ac.add_workout_class(tes)
    assert ac._workouts == {'Kickboxing': kickboxing, 'test': tes}
    assert ac.add_workout_class(tes) is False
예제 #4
0
def test_add_three_workout_schedule_1_dup_time() -> None:
    """ Add three workout to the schedule, 2 with different rooms
    at the same time, and one with a room at a different time"""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    timmy = Instructor(2, 'Timmy')
    assert ac.add_instructor(diane)
    assert ac.add_instructor(timmy)

    assert diane.add_certificate('Cardio 1')
    assert timmy.add_certificate('Cardio 1')

    assert ac.add_room('Dance Studio', 50)
    assert ac.add_room('Bike Studio', 50)

    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)

    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    sep_9_2020_1_00 = datetime(2020, 9, 9, 1, 0)

    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio',
                                     boot_camp.get_name(), diane.get_id())

    assert ac.schedule_workout_class(sep_9_2020_1_00, 'Dance Studio',
                                     boot_camp.get_name(), timmy.get_id())

    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Bike Studio',
                                     boot_camp.get_name(),
                                     diane.get_id()) is False
예제 #5
0
def test_add_5_workouts() -> None:
    """Add three workouts to the Gym"""
    ac = Gym('Athletic Centre')
    kickboxing = WorkoutClass('Kickboxing', ['Strength Training'])
    a = WorkoutClass('b', ['Strength Training'])
    b = WorkoutClass('c', ['Strength Training'])
    d = WorkoutClass('d', ['Strength Training'])
    e = WorkoutClass('e', ['Strength Training'])
    assert ac.add_workout_class(kickboxing)
    assert ac.add_workout_class(a)
    assert ac.add_workout_class(b)
    assert ac.add_workout_class(d)
    a = WorkoutClass('bz', ['Strength Training'])
    assert ac.add_workout_class(e)
    assert ac.add_workout_class(a)
    assert len(ac._workouts) == 6
예제 #6
0
def test_add_three_workout_schedule_3_at_same_time() -> None:
    """ Add three different workouts to the schedule at the same time"""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    timmy = Instructor(2, 'Timmy')
    greg = Instructor(3, 'Greg')
    assert ac.add_instructor(diane)
    assert ac.add_instructor(timmy)
    assert ac.add_instructor(greg)

    assert diane.add_certificate('Cardio 1')
    assert timmy.add_certificate('Cardio 1')
    assert greg.add_certificate('Cardio 1')

    assert ac.add_room('Dance Studio', 50)
    assert ac.add_room('Bike Studio', 50)
    assert ac.add_room('Lift Studio', 50)

    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)

    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)

    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio',
                                     boot_camp.get_name(), diane.get_id())

    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Lift Studio',
                                     boot_camp.get_name(), greg.get_id())

    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Bike Studio',
                                     boot_camp.get_name(),
                                     diane.get_id()) is False
예제 #7
0
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}
예제 #8
0
def test_gym_many_instructors_mixed_hours_mixed_certificates_JEN() -> None:
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    instructor2 = Instructor(12, 'Jennifer')
    swimming = WorkoutClass('Swimming', [])
    crossfit = WorkoutClass('Cross Fit', ['Cross Fit'])
    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_workout_class(crossfit)
    assert ac.add_instructor(instructor)
    assert ac.add_instructor(instructor2)
    assert instructor2.add_certificate('Cross Fit')
    assert ac.add_room('25-yard Pool', 100)
    assert ac.add_room('Weight Room', 50)
    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_11_00, 'Weight Room',
                                     crossfit.get_name(), instructor2.get_id())
    assert ac.schedule_workout_class(jan_28_2020_12_00, 'Weight Room',
                                     crossfit.get_name(), instructor2.get_id())
    t1 = datetime(2020, 1, 17, 11, 0)
    t2 = datetime(2020, 1, 29, 13, 0)
    assert ac.payroll(t1, t2, 22.0) == [(5, 'Matthew', 1, 22.0),
                                        (12, 'Jennifer', 2, 47.0)]
예제 #9
0
def test_gym() -> None:
    gc = Gym("Gold Ring")
    assert gc.name == "Gold Ring"
    assert gc._instructors == {}
    assert gc._workouts == {}
    assert gc._rooms == {}
    assert gc._schedule == {}
    diane = Instructor(1, 'Diane')
    assert gc.add_instructor(diane) is True
    assert gc.add_instructor(diane) is False
    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'])
    assert gc.add_workout_class(workout_class_run) is True
    assert gc.add_workout_class(workout_class_run) is False
    assert gc.add_workout_class(workout_class_cycling) is True
    assert gc.add_room('Cycling Room', 100) is True
    assert gc.add_room('Strength Room', 100) is True
    assert gc.add_room('Strength Room', 200) is False
    assert len(gc._instructors) == 1
    assert len(gc._workouts) == 2
    assert len(gc._rooms) == 2
    # Testing if we can schedule a workout when the instructor is not qualified
    JAN_27_2020 = datetime(2020, 1, 27, 12, 0)
    assert gc.schedule_workout_class(JAN_27_2020, 'Strength Room',
                                     workout_class_run.get_name(),
                                     diane.get_id()) is False
    diane.add_certificate('Strength Training')
    diane.add_certificate('Interval Training')
    diane.add_certificate('Long Runs')
    diane.add_certificate('Tempo')
    diane.add_certificate('FTP Test')
    # Testing if we can schedule when the instructor is qualified
    assert gc.schedule_workout_class(JAN_27_2020, 'Strength Room',
                                     workout_class_run.get_name(),
                                     diane.get_id()) is True
    # Testing if we can schedule when the instructor who is already scheduled
    assert gc.schedule_workout_class(JAN_27_2020, 'Strength Room',
                                     workout_class_run.get_name(),
                                     diane.get_id()) is False
    # Trying to add an offering when the instructor is not available
    assert gc.schedule_workout_class(JAN_27_2020, 'Cycling Room',
                                     workout_class_cycling.get_name(),
                                     diane.get_id()) is False
예제 #10
0
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)]
예제 #11
0
def test_schedule_unqualified_instructor_JEN() -> None:
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    assert ac.add_instructor(instructor)
    assert ac.add_room('25-yard Pool', 100)
    swimming = WorkoutClass('Swimming', ['Lifeguard'])
    assert ac.add_workout_class(swimming)
    jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0)
    assert not ac.schedule_workout_class(jan_28_2020_11_00, '25-yard Pool',
                                         swimming.get_name(),
                                         instructor.get_id())
예제 #12
0
def test_add_one_workout_schedule() -> None:
    """ Add one workout to the schedule"""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    assert ac.add_instructor(diane)
    assert diane.add_certificate('Cardio 1')
    assert ac.add_room('Dance Studio', 50)
    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)
    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio',
                                     boot_camp.get_name(), diane.get_id())
예제 #13
0
def test_register() -> None:
    gc = Gym("Gold Ring")
    diane = Instructor(1, 'Diane')
    roney = Instructor(2, 'Roney')
    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)
    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())
    # Testing if we can register a new client,
    # if the instructor is not qualified
    assert gc.register(JAN_27_2020, 'Philip', 'Running') is False
    diane.add_certificate('Strength Training')
    diane.add_certificate('Interval Training')
    diane.add_certificate('Long Runs')
    diane.add_certificate('Tempo')
    diane.add_certificate('FTP Test')
    gc.schedule_workout_class(JAN_27_2020, 'Strength Room',
                              workout_class_run.get_name(), diane.get_id())
    assert gc.register(JAN_27_2020, 'Philip', 'Running') is True
    # Testing if we can register a already registered client
    assert gc.register(JAN_27_2020, 'Philip', 'Running') is False
    # Testing if we can register a already registered client to different class
    assert gc.register(JAN_27_2020, 'Philip', 'Cycling Basics') is False
    # Testing if we can register to already full class
    assert gc.register(JAN_27_2020, 'Roth', 'Running') is False
    assert gc.register(JAN_27_2020, 'Roth', 'Cycling Basics') is False
예제 #14
0
def test_gym_register_one_class() -> None:
    """Test Gym.register with a single user and class."""
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    swimming = WorkoutClass('Swimming', ['Lifeguard'])
    jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0)
    assert instructor.add_certificate('Lifeguard')
    assert ac.add_workout_class(swimming)
    assert ac.add_instructor(instructor)
    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.register(jan_28_2020_11_00, 'Benjamin', 'Swimming')
예제 #15
0
def test_gym_one_instructor_one_hour_pay_no_certificates() -> None:
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    swimming = WorkoutClass('Swimming', [])
    jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0)
    assert ac.add_workout_class(swimming)
    assert ac.add_instructor(instructor)
    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())
    t1 = datetime(2020, 1, 17, 11, 0)
    t2 = datetime(2020, 1, 29, 13, 0)
    assert ac.payroll(t1, t2, 22.0) == [(5, 'Matthew', 1, 22)]
예제 #16
0
def test_gym_offerings_at_one_class() -> None:
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    swimming = WorkoutClass('Swimming', ['Lifeguard'])
    jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0)
    assert instructor.add_certificate('Lifeguard')
    assert ac.add_workout_class(swimming)
    assert ac.add_instructor(instructor)
    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.offerings_at(jan_28_2020_11_00) == \
           [('Matthew', 'Swimming', '25-yard Pool')]
예제 #17
0
def test_schedule_workout_can_teach() -> None:
    """Test schedule workout can teach."""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    assert ac.add_instructor(diane)
    #  assert diane.add_certificate('Cardio 1')
    assert ac.add_room('Dance Studio', 50)
    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)
    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio',
                                     boot_camp.get_name(),
                                     diane.get_id()) is False
    assert ac._schedule == {}
예제 #18
0
def test_register_over_capacity() -> None:
    """Add too many people to a room"""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    assert diane.add_certificate('Cardio 1')
    assert ac.add_instructor(diane)
    assert ac.add_room('Dance Studio', 1)
    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)
    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio', \
                                     boot_camp.get_name(), diane.get_id())
    assert ac.register(sep_9_2019_12_00, 'Greg', 'Boot Camp')
    assert ac.register(sep_9_2019_12_00, 'Tim', 'Boot Camp') is False
예제 #19
0
def test_register_one_person() -> None:
    """Register one person to one workout class"""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    assert diane.add_certificate('Cardio 1')
    assert ac.add_instructor(diane)
    assert ac.add_room('Dance Studio', 50)
    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)
    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio', \
                                   boot_camp.get_name(), diane.get_id())
    assert ac.register(sep_9_2019_12_00, 'Philip', 'Boot Camp')
    assert ac.register(sep_9_2019_12_00, 'Tim', 'Boot Camp') is True
예제 #20
0
def test_gym_register_everything() -> None:
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    dian = Instructor(2, 'Dian')
    assert diane.add_certificate('Cardio 1')
    assert dian.add_certificate('Cardio 1')
    assert ac.add_instructor(diane)
    assert ac.add_instructor(dian)

    assert ac.add_room('Dance Studio', 3)
    assert ac.add_room('Danc Studio', 3)

    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)

    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    sep_9_2019_13_00 = datetime(2019, 9, 9, 13, 0)
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio', \
                                     boot_camp.get_name(), diane.get_id())
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Danc Studio', \
                                     boot_camp.get_name(), dian.get_id())

    assert ac.register(sep_9_2019_12_00, 'Philip', 'Boot Camp')
    assert ac.register(datetime(2019, 9, 9, 11, 0), 'Philip', 'Boot Camp') is False
    assert ac.register(sep_9_2019_12_00, 'Philip', 'Boot Camp') is False
    assert ac.register(sep_9_2019_12_00, 'test', 'Boot Camp')
    assert ac.register(sep_9_2019_12_00, 'tes', 'Boot Camp')
    assert ac.register(sep_9_2019_12_00, 'te', 'Boot Camp')
    assert ac.register(sep_9_2019_12_00, 'tes', 'Boot Camp') is False

    assert ac._schedule == {sep_9_2019_12_00:
        {'Dance Studio': (diane, boot_camp, ['Philip', 'test', 'tes']),
         'Danc Studio': (dian, boot_camp, ['te'])}}

    assert ac.register(sep_9_2019_12_00, 'ts', 'Boot Camp')
    assert ac.register(sep_9_2019_12_00, 't', 'Boot Camp')
    assert ac.register(sep_9_2019_12_00, 'z', 'Boot Camp') is False
    assert ac._schedule == {sep_9_2019_12_00:
        {'Dance Studio': (diane, boot_camp, ['Philip', 'test', 'tes']),
         'Danc Studio': (dian, boot_camp, ['te', 'ts', 't'])}}

    assert ac.schedule_workout_class(sep_9_2019_13_00, 'Danc Studio', \
                                     boot_camp.get_name(), dian.get_id())
    assert ac.register(sep_9_2019_13_00, 'a', 'Boot Camp')

    assert ac._schedule == {sep_9_2019_12_00:
        {'Dance Studio': (diane, boot_camp, ['Philip', 'test', 'tes']),
         'Danc Studio': (dian, boot_camp, ['te', 'ts', 't'])},
          sep_9_2019_13_00: {'Danc Studio': (dian, boot_camp, ['a'])}}
예제 #21
0
def test_register_same_person_diff_room() -> None:
    """Register 2 diff people to same workout class, diff room, same time"""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    assert diane.add_certificate('Cardio 1')
    assert ac.add_instructor(diane)

    timmy = Instructor(2, 'Timmy')
    assert timmy.add_certificate('Cardio 1')
    assert ac.add_instructor(timmy)

    assert ac.add_room('Dance Studio', 1)
    assert ac.add_room('Bike Studio', 1)
    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    workout_camp = WorkoutClass('workout 1', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)
    assert ac.add_workout_class(workout_camp)
    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio', \
                                   boot_camp.get_name(), diane.get_id())
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Bike Studio', \
                                     workout_camp.get_name(), timmy.get_id())
    assert ac.register(sep_9_2019_12_00, 'Greg', 'Boot Camp')
    assert ac.register(sep_9_2019_12_00, 'Kim', 'workout 1')
예제 #22
0
def test_instr_teaching_other_class_JEN() -> None:
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    assert ac.add_instructor(instructor)
    assert ac.add_room('25-yard Pool', 100)
    assert ac.add_room('Weight Room', 100)
    swimming = WorkoutClass('Swimming', ['Lifeguard'])
    crossfit = WorkoutClass('Cross Fit', [])
    assert instructor.add_certificate('Lifeguard')
    assert ac.add_workout_class(swimming)
    assert ac.add_workout_class(crossfit)
    jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0)
    assert ac.schedule_workout_class(jan_28_2020_11_00, '25-yard Pool',
                                     swimming.get_name(), instructor.get_id())
    assert not ac.schedule_workout_class(jan_28_2020_11_00, 'Weight Room',
                                         crossfit.get_name(),
                                         instructor.get_id())
예제 #23
0
def test_schedule_in_unavailable_room_JEN() -> None:
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    assert ac.add_instructor(instructor)
    instructor2 = Instructor(6, 'Jennifer')
    assert ac.add_instructor(instructor2)
    assert ac.add_room('25-yard Pool', 100)
    swimming = WorkoutClass('Swimming', ['Lifeguard'])
    assert ac.add_workout_class(swimming)
    assert instructor.add_certificate('Lifeguard')
    assert instructor2.add_certificate('Lifeguard')
    jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0)
    assert ac.schedule_workout_class(jan_28_2020_11_00, '25-yard Pool',
                                     swimming.get_name(), instructor.get_id())
    assert not ac.schedule_workout_class(jan_28_2020_11_00, '25-yard Pool',
                                         swimming.get_name(),
                                         instructor2.get_id())
예제 #24
0
def test_register_no_room_left_move_to_other_room_JEN() -> None:
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    instructor2 = Instructor(15, 'Jennifer')
    swimming = WorkoutClass('Swimming', ['Lifeguard'])
    jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0)
    assert instructor.add_certificate('Lifeguard')
    assert instructor2.add_certificate('Lifeguard')
    assert ac.add_workout_class(swimming)
    assert ac.add_instructor(instructor)
    assert ac.add_instructor(instructor2)
    assert ac.add_room('25-yard Pool', 1)
    assert ac.add_room('Weight Room', 1)
    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_11_00, 'Weight Room',
                                     swimming.get_name(), instructor2.get_id())
    assert ac.register(jan_28_2020_11_00, 'Benjamin', 'Swimming')
예제 #25
0
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}
예제 #26
0
def test_gym_register_many_classes_JEN() -> None:
    ac = Gym('Athletic Centre')
    instructor = Instructor(5, 'Matthew')
    instructor2 = Instructor(15, 'Jennifer')
    swimming = WorkoutClass('Swimming', ['Lifeguard'])
    crossfit = WorkoutClass('Cross Fit', ['Cross Fit'])
    jan_28_2020_11_00 = datetime(2020, 1, 29, 11, 0)
    assert instructor.add_certificate('Lifeguard')
    assert instructor2.add_certificate('Cross Fit')
    assert ac.add_workout_class(swimming)
    assert ac.add_workout_class(crossfit)
    assert ac.add_instructor(instructor)
    assert ac.add_instructor(instructor2)
    assert ac.add_room('25-yard Pool', 100)
    assert ac.add_room('Weight Room', 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_11_00, 'Weight Room',
                                     crossfit.get_name(), instructor2.get_id())
    assert ac.register(jan_28_2020_11_00, 'Benjamin', 'Swimming')
    assert not ac.register(jan_28_2020_11_00, 'Benjamin', 'Cross Fit')
예제 #27
0
def test_schedule_workout_room_available() -> None:
    """Test schedule workout can teach."""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    assert ac.add_instructor(diane)
    test = Instructor(2, 'Diane')
    assert ac.add_instructor(test)
    assert diane.add_certificate('Cardio 1')
    assert test.add_certificate('Cardio 1')
    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)
    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dan Studio',
                                     boot_camp.get_name(),
                                     diane.get_id()) is False
    assert ac._schedule == {}
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio',
                                     boot_camp.get_name(),
                                     diane.get_id())
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio',
                                     boot_camp.get_name(),
                                     diane.get_id()) is False
    assert ac._schedule == {sep_9_2019_12_00: {'Dance Studio':
                                                   (diane, boot_camp, [])}}
    assert ac.schedule_workout_class(datetime(2019, 9, 9, 1, 0), 'Dance Studio',
                                     boot_camp.get_name(),
                                     diane.get_id())
    assert ac.schedule_workout_class(datetime(2019, 9, 9, 1, 0), 'Danc Studio',
                                     boot_camp.get_name(),
                                     diane.get_id()) is False
    assert ac.schedule_workout_class(datetime(2019, 9, 9, 1, 0), 'Danc Studio',
                                     boot_camp.get_name(),
                                     test.get_id())
    assert ac._schedule == {sep_9_2019_12_00:
                            {'Dance Studio': (diane, boot_camp, [])},
                            datetime(2019, 9, 9, 1, 0):
                            {'Dance Studio': (diane, boot_camp, []),
                             'Danc Studio': (test, boot_camp, [])}}
예제 #28
0
def test_add_three_workout_schedule_diff_time_unqualified() -> None:
    """ Add three workout to the schedule at different times, but
    instructor unqualified so you can't"""
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    timmy = Instructor(2, 'Timmy')
    assert ac.add_instructor(diane)
    assert ac.add_instructor(timmy)

    assert timmy.add_certificate('Cardio 1')
    assert ac.add_room('Dance Studio', 50)
    boot_camp = WorkoutClass('Boot Camp', ['Cardio 1'])
    assert ac.add_workout_class(boot_camp)
    sep_9_2019_12_00 = datetime(2019, 9, 9, 12, 0)
    sep_9_2020_12_00 = datetime(2020, 9, 9, 12, 0)
    sep_9_2020_1_00 = datetime(2020, 9, 9, 1, 0)
    assert ac.schedule_workout_class(sep_9_2019_12_00, 'Dance Studio',
                                     boot_camp.get_name(),
                                     diane.get_id()) is False
    assert ac.schedule_workout_class(sep_9_2020_12_00, 'Dance Studio',
                                     boot_camp.get_name(),
                                     diane.get_id()) is False
    assert ac.schedule_workout_class(sep_9_2020_1_00, 'Dance Studio',
                                     boot_camp.get_name(), timmy.get_id())
예제 #29
0
def test_gym_offerings_everything() -> None:
    ac = Gym('Athletic Centre')
    diane = Instructor(1, 'Diane')
    dian = Instructor(2, 'Dian')
    dia = Instructor(3, 'Dia')

    assert diane.add_certificate('Cardio 1')
    assert dian.add_certificate('Cardio 1')
    assert dia.add_certificate('Cardio 1')

    assert ac.add_instructor(diane)
    assert ac.add_instructor(dian)
    assert ac.add_instructor(dia)

    assert ac.add_room('Dance Studio', 50)
    assert ac.add_room('Danc Studio', 50)
    assert ac.add_room('Dan 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, 9, 13, 0)
    assert ac.offerings_at(t1) == []
    assert ac.schedule_workout_class(t1, 'Dance Studio', \
                              boot_camp.get_name(), diane.get_id())
    assert ac.offerings_at(t1) == [('Diane', 'Boot Camp', 'Dance Studio')]
    assert ac.schedule_workout_class(t1, 'Danc Studio', \
                                     boot_camp.get_name(), dian.get_id())
    assert ac.schedule_workout_class(t1, 'Dan Studio', \
                                     boot_camp.get_name(), dia.get_id())
    assert ac.offerings_at(t1) == [('Diane', 'Boot Camp', 'Dance Studio'),
                                   ('Dian', 'Boot Camp', 'Danc Studio'),
                                   ('Dia', 'Boot Camp', 'Dan Studio'),]
    assert ac.schedule_workout_class(t2, 'Dance Studio', \
                                     boot_camp.get_name(), diane.get_id())
    assert ac.offerings_at(t2) == [('Diane', 'Boot Camp', 'Dance Studio')]
예제 #30
0
def test_add_one_workout() -> None:
    """Add one workout to the Gym"""
    ac = Gym('Athletic Centre')
    kickboxing = WorkoutClass('Kickboxing', ['Strength Training'])
    assert ac.add_workout_class(kickboxing)