TicTacToe tests: Extend tests to end of game lose condition & quit.
MODIFY
zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py
zulip_bots/zulip_bots/bots/tictactoe/test_tictactoe.py
@@ -44,7 +44,13 @@ class TestTictactoeBot(StubBotTestCase):
"My turn:\n[ x o x ]\n[ x o _ ]\n[ o x o ]\n"
"Your turn! Enter a coordinate or type help."),
after_2_3_draw = ("[ x o x ]\n[ x o x ]\n[ o x o ]\n"
- "It's a draw! Neither of us was able to win.")
+ "It's a draw! Neither of us was able to win."),
+ after_2_3_try_lose = ("[ x _ _ ]\n[ _ o x ]\n[ _ _ _ ]\n"
+ "My turn:\n[ x _ _ ]\n[ _ o x ]\n[ _ o _ ]\n"
+ "Your turn! Enter a coordinate or type help."),
+ after_2_1_lost = ("[ x _ _ ]\n[ x o x ]\n[ _ o _ ]\n"
+ "My turn:\n[ x o _ ]\n[ x o x ]\n[ _ o _ ]\n"
+ "Game over! I've won!"),
)
conversation = [
@@ -88,6 +94,12 @@ class TestTictactoeBot(StubBotTestCase):
("2,3", msg['after_2_3_draw']),
# Game already over; can't quit FIXME improve response?
("quit", msg['didnt_understand']),
+ ("new", msg['new_game']),
+ ("1,1", msg['after_1_1']),
+ ("2,3", msg['after_2_3_try_lose']),
+ ("2,1", msg['after_2_1_lost']),
+ # Game already over; can't quit FIXME improve response?
+ ("quit", msg['didnt_understand']),
]
with patch('zulip_bots.bots.tictactoe.tictactoe.random.choice') as choice:

TicTacToe tests: Extend tests to end of game lose condition & quit.