def test_check_solution_answer_no_answer(mocker): with open(str(SAVED / "solved_problem.html")) as f: soup = w.get_soup(mocker.Mock(content=f.read())) with pytest.raises(ValueError) as exc: w.check_solution_answer(soup) assert "Cannot say whether" in str(exc.value)
def test_get_already_found_no(mocker): with open(str(SAVED / "new_problem.html")) as f: soup = w.get_soup(mocker.Mock(content=f.read())) assert w.get_already_found(soup) is None
def test_get_already_found_yes(mocker): with open(str(SAVED / "solved_problem.html")) as f: soup = w.get_soup(mocker.Mock(content=f.read())) assert w.get_already_found(soup) == 233168
def test_check_solution_answer_bad(mocker): with open(str(SAVED / "answer_incorrect.html")) as f: soup = w.get_soup(mocker.Mock(content=f.read())) assert not w.check_solution_answer(soup)
def test_get_soup(mocker): with open(str(SAVED / "solved_problem.html")) as f: soup = w.get_soup(mocker.Mock(content=f.read())) assert "If we list all the natural numbers" in ( soup.select_one(".problem_content").get_text())