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_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."