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

Function test_main

tests/test_blackjack.py:182–195  ·  view source on GitHub ↗
(capsys)

Source from the content-addressed store, hash-verified

180
181
182def test_main(capsys):
183 # Test basic game:
184 random.seed(42)
185 sys.stdin = io.StringIO('100\nS\n\n\n')
186 with pytest.raises(SystemExit):
187 blackjack.main()
188 captured = capsys.readouterr()
189 assert '|3 | |10 |' in captured.out
190
191 # Test quitting:
192 random.seed(42)
193 sys.stdin = io.StringIO('quit\n')
194 with pytest.raises(SystemExit):
195 blackjack.main()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected