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

Function test_getPlayerMove

tests/test_chancecheckers.py:71–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected