Skip to content

Commit 1f8b122

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3833ba1 commit 1f8b122

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

games/snake_water_gun.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727

2828
WIN_CONDITIONS = {
2929
"Snake": "Water", # Snake drinks Water
30-
"Water": "Gun", # Water damages Gun
31-
"Gun": "Snake", # Gun kills Snake
30+
"Water": "Gun", # Water damages Gun
31+
"Gun": "Snake", # Gun kills Snake
3232
}
3333

3434

@@ -100,4 +100,4 @@ def main() -> None:
100100

101101

102102
if __name__ == "__main__":
103-
main()
103+
main()

tests/games/test_snake_water_gun.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@
3838

3939
@pytest.mark.parametrize(
4040
"player_choice, computer_choice",
41-
[
42-
(p, c)
43-
for p in VALID_CHOICES
44-
for c in VALID_CHOICES
45-
],
41+
[(p, c) for p in VALID_CHOICES for c in VALID_CHOICES],
4642
)
4743
def test_all_outcomes(player_choice: str, computer_choice: str, monkeypatch) -> None:
4844
"""
@@ -103,6 +99,7 @@ def test_invalid_input_returns_error(invalid_input: str) -> None:
10399
# Tests for main() interactive loop
104100
# ---------------------------------------------------------------------------
105101

102+
106103
def test_main_quit_immediately(monkeypatch, capsys) -> None:
107104
"""Typing 'quit' right away exits the loop with a goodbye message."""
108105
monkeypatch.setattr("sys.stdin", StringIO("quit\n"))
@@ -121,4 +118,4 @@ def test_main_one_round_then_quit(monkeypatch, capsys) -> None:
121118
main()
122119
captured = capsys.readouterr()
123120
assert "You chose Snake, Computer chose Water. You win!" in captured.out
124-
assert "Thanks for playing. Goodbye!" in captured.out
121+
assert "Thanks for playing. Goodbye!" in captured.out

0 commit comments

Comments
 (0)