def test_teacher_assing_work():
    teacher = Teacher("John", "Smith", datetime.datetime(2020, 1, 1), 1234)
    math = Classroom("Math")
    teacher.add_class(math)

    assert teacher.assign_work(
        math) == "John Smith assigns work to Math class."
def test_cant_assign_work_to_someone_elses_class():
    teacher = Teacher("John", "Smith", datetime.datetime(2020, 1, 1), 1234)

    # raise an error if assigning work to a class not taught by the teacher
    someone_elses_class = Classroom("Computer Studies")
    with pytest.raises(Exception):
        teacher.assign_work(someone_elses_class)
def test_teacher_getters_setters():
    teacher = Teacher("John", "Smith", datetime.datetime(2020, 1, 1), 1234)
    assert teacher.get_first_name() == "John"

    teacher.set_OCT_PIN(5432)
    assert teacher.get_OCT_PIN() == 5432

    teacher.set_school("St. Joan")
    assert teacher.get_school() == "St. Joan"
def test_teacher_cannot_have_more_than_6_classes():
    teacher = Teacher("John", "Smith", datetime.datetime(2020, 1, 1), 1234)

    # OK to have 6
    for i in range(6):
        some_class = Classroom(str(i))
        teacher.add_class(some_class)

    with pytest.raises(Exception):
        one_too_many = Classroom("Cant teach this")
        teacher.add_class(one_too_many)

    assert len(teacher.get_classes()) == 6
def test_teacher_greet():
    teacher = Teacher("John", "Smith", datetime.datetime(2020, 1, 1), 1234)
    assert teacher.greet() == "Hello, my name is John Smith and I'm a teacher."
def test_teacher_add_remove_class():
    teacher = Teacher("John", "Smith", datetime.datetime(2020, 1, 1), 1234)
    some_class = Classroom("Math")
    teacher.add_class(some_class)

    assert some_class in teacher.get_classes()

    teacher.remove_class(some_class)
    assert teacher.get_classes() == []

    # ensure you cannot teach the same class twice
    teacher.add_class(some_class)
    with pytest.raises(Exception):
        teacher.add_class(some_class)
def test_teacher_init():
    teacher = Teacher("John", "Smith", datetime.datetime(2020, 1, 1), 1234)
    assert isinstance(teacher, Person)
    assert teacher._OCT_PIN == 1234
    assert teacher._email_k12 == "*****@*****.**"
    assert teacher._classes == []