def test_check_guess_against_saved_incorrect(mocker):
    mocker.patch("aocd.models.Puzzle._get_answer", return_value="two")
    puzzle = Puzzle(year=2019, day=4)
    rv = puzzle._check_guess_against_existing("one", "a")
    assert "Part a already solved with different answer: two" in rv
def test_check_guess_against_empty(mocker):
    mocker.patch("aocd.models.Puzzle._get_answer", return_value="")
    puzzle = Puzzle(year=2019, day=4)
    rv = puzzle._check_guess_against_existing("one", "a")
    assert rv is None
def test_check_guess_against_saved_correct(mocker):
    mocker.patch("aocd.models.Puzzle._get_answer", return_value="one")
    puzzle = Puzzle(year=2019, day=4)
    rv = puzzle._check_guess_against_existing("one", "a")
    assert rv == "Part a already solved with same answer: one"
def test_check_guess_against_unsolved(mocker):
    mocker.patch("aocd.models.Puzzle._get_answer",
                 side_effect=PuzzleUnsolvedError)
    puzzle = Puzzle(year=2019, day=4)
    rv = puzzle._check_guess_against_existing("one", "a")
    assert rv is None