Ejemplo n.º 1
0
def test_instructor() -> None:
    instructor = Instructor(1, 'Tim Apple')
    assert instructor.name == 'Tim Apple'
    assert instructor.get_id() == 1
    assert instructor.get_num_certificates() == 0
    workout_class = WorkoutClass('Running',
                                 ['Strength Training', 'Interval Training'])
    assert instructor.can_teach(workout_class) is False
    instructor.add_certificate('Strength Training')
    assert instructor.can_teach(workout_class) is False
    instructor.add_certificate('Interval Training')
    assert instructor.can_teach(workout_class) is True
    assert instructor.get_num_certificates() == 2
Ejemplo n.º 2
0
def test_instructor_attributes() -> None:
    """Test the public attributes of a new instructor."""
    instructor = Instructor(5, 'Matthew')
    assert instructor.get_id() == 5
    assert instructor.name == 'Matthew'
    assert instructor.get_num_certificates() == 0
    kickboxing = WorkoutClass('Kickboxing', ['Strength Training'])
    assert instructor.can_teach(kickboxing) is False
Ejemplo n.º 3
0
def test_instructor_one_certificate_get_multiple_certificates() -> None:
    """Test Instructor.get_num_certificates with 5 certificate."""
    instructor = Instructor(5, 'Matthew')
    assert instructor.add_certificate('a')
    assert instructor.add_certificate('b')
    assert instructor.add_certificate('c')
    assert instructor.add_certificate('d')
    assert instructor.add_certificate('e')
    assert instructor.get_num_certificates() == 5
Ejemplo n.º 4
0
def test_instructor_get_multi_2f_certificates() -> None:
    """Test Instructor.get_num_certificates with 3T, 2 duplicate
    certificates."""
    instructor = Instructor(5, 'Matthew')
    assert instructor.add_certificate('a')
    instructor.add_certificate('a')
    instructor.add_certificate('a')
    assert instructor.add_certificate('d')
    assert instructor.add_certificate('e')
    assert instructor.get_num_certificates() == 3
Ejemplo n.º 5
0
def test_instructor_multiple_certificate_can_teach() -> None:
    """Test Instructor.can_teach with a single satisfying certificate."""
    instructor = Instructor(5, 'Matthew')
    swimming = WorkoutClass('Swimming', ['Lifeguard', 'test', 'tes'])
    assert instructor.add_certificate('Lifeguard')
    assert instructor.can_teach(swimming) is False
    assert instructor.add_certificate('l')
    assert instructor.can_teach(swimming) is False
    assert instructor.add_certificate('tes')
    assert instructor.can_teach(swimming) is False
    assert instructor.add_certificate('test')
    assert instructor.can_teach(swimming)
    assert instructor.get_num_certificates() == 4
Ejemplo n.º 6
0
def test_instructor_one_certificate_get_certificates() -> None:
    """Test Instructor.get_num_certificates with a single certificate."""
    instructor = Instructor(5, 'Matthew')
    assert instructor.add_certificate('Kickboxing')
    assert instructor.get_num_certificates() == 1