TicTacToe tests: Extend tests to end of game lose condition & quit.
This commit is contained in:
parent
62d781a53e
commit
969b984b80
|
@ -44,7 +44,13 @@ class TestTictactoeBot(StubBotTestCase):
|
||||||
"My turn:\n[ x o x ]\n[ x o _ ]\n[ o x o ]\n"
|
"My turn:\n[ x o x ]\n[ x o _ ]\n[ o x o ]\n"
|
||||||
"Your turn! Enter a coordinate or type help."),
|
"Your turn! Enter a coordinate or type help."),
|
||||||
after_2_3_draw = ("[ x o x ]\n[ x o x ]\n[ o x o ]\n"
|
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 = [
|
conversation = [
|
||||||
|
@ -88,6 +94,12 @@ class TestTictactoeBot(StubBotTestCase):
|
||||||
("2,3", msg['after_2_3_draw']),
|
("2,3", msg['after_2_3_draw']),
|
||||||
# Game already over; can't quit FIXME improve response?
|
# Game already over; can't quit FIXME improve response?
|
||||||
("quit", msg['didnt_understand']),
|
("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:
|
with patch('zulip_bots.bots.tictactoe.tictactoe.random.choice') as choice:
|
||||||
|
|
Loading…
Reference in a new issue