Replacing blanks with guesses
This commit is contained in:
+11
-4
@@ -8,9 +8,16 @@ def run(monkeypatch, capsys, word, letter):
|
||||
return capsys.readouterr().out
|
||||
|
||||
|
||||
def test_right_guess(monkeypatch, capsys):
|
||||
assert "Right" in run(monkeypatch, capsys, "camel", "a")
|
||||
def test_right_guess_fills_blanks(monkeypatch, capsys):
|
||||
out = run(monkeypatch, capsys, "camel", "a")
|
||||
assert out.splitlines() == [
|
||||
"_ _ _ _ _",
|
||||
"Right, 'a' is in the word.",
|
||||
"_ a _ _ _",
|
||||
]
|
||||
|
||||
|
||||
def test_wrong_guess(monkeypatch, capsys):
|
||||
assert "Wrong" in run(monkeypatch, capsys, "camel", "z")
|
||||
def test_wrong_guess_keeps_blanks(monkeypatch, capsys):
|
||||
out = run(monkeypatch, capsys, "camel", "z")
|
||||
assert "Wrong" in out
|
||||
assert out.splitlines()[-1] == "_ _ _ _ _"
|
||||
|
||||
Reference in New Issue
Block a user