Example #1
0
def test_check_homework_function_adds_HomeworkResult_object_to_homework_done():
    student = Student("Valya", "Petrova")
    teacher = Teacher("Albert", "")
    hw = teacher.create_homework("Do it", 3)
    hw_result = student.do_homework(hw, "correct_solution")
    teacher.check_homework(hw_result)

    assert isinstance(Teacher.homework_done[hw]["correct_solution"],
                      HomeworkResult)
Example #2
0
def test_reset_results_function_deletes_Homework_object_in_homework_done():
    Teacher.reset_results()
    student = Student("Valya", "Petrova")
    teacher = Teacher("Albert", "")
    hw = teacher.create_homework("Do it", 3)
    hw_result = student.do_homework(hw, "correct_solution")
    teacher.check_homework(hw_result)
    Teacher.reset_results(hw)

    assert not Teacher.homework_done
Example #3
0
def test_reset_results_function_completely_frees_homework_done():
    student = Student("Valya", "Petrova")
    teacher = Teacher("Albert", "")
    hw = teacher.create_homework("Do it", 3)
    hw2 = teacher.create_homework("Just do it", 5)
    hw_result = student.do_homework(hw, "correct_solution")
    hw_result2 = student.do_homework(hw2, "correct_solution2")
    teacher.check_homework(hw_result)
    teacher.check_homework(hw_result2)
    Teacher.reset_results()

    assert not Teacher.homework_done
Example #4
0
def test_check_homework_function_returns_True():
    student = Student("Valya", "Petrova")
    teacher = Teacher("Albert", "")
    hw = teacher.create_homework("Do it", 3)
    hw_result = student.do_homework(hw, "correct_solution")

    assert teacher.check_homework(hw_result) is True