コード例 #1
0
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)
コード例 #2
0
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
コード例 #3
0
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
コード例 #4
0
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)
コード例 #5
0
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())