MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / test_getPlayerMove

Function test_getPlayerMove

tests/test_checkers.py:72–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70
71
72def test_getPlayerMove():
73 board = checkers.getNewBoard()
74 sys.stdin = io.StringIO('B3\nA4\n')
75 assert checkers.getPlayerMove(board, 'X') == ('B3', 'A4')
76
77 # Test quitting:
78 board = checkers.getNewBoard()
79 with pytest.raises(SystemExit):
80 sys.stdin = io.StringIO('QUIT\n')
81 checkers.getPlayerMove(board, 'X')
82
83 with pytest.raises(SystemExit):
84 sys.stdin = io.StringIO('quit\n')
85 checkers.getPlayerMove(board, 'X')
86
87 with pytest.raises(SystemExit):
88 sys.stdin = io.StringIO('qUiT\n')
89 checkers.getPlayerMove(board, 'X')
90
91 with pytest.raises(SystemExit):
92 sys.stdin = io.StringIO(' quit \n')
93 checkers.getPlayerMove(board, 'X')
94
95
96def test_makeMove():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected