def test_classroom_getters_setters(): math = Classroom("Math") assert math.get_students() == [] assert math.get_name() == "Math" math.set_name("Blah") assert math.get_name() == "Blah"
def test_classroom_add_remove_student(): class StudentMock: pass math = Classroom("Math") some_student = StudentMock() math.add_student(some_student) assert len(math.get_students()) == 1 math.remove_student(some_student) assert math.get_students() == [] # Raises some exception when removing a studentnot in the class. with pytest.raises(Exception): math.remove_student(some_student) # Raise an exception when the same student is added to the same class math.add_student(some_student) with pytest.raises(Exception): math.add_student(some_student)