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

Function test_getCardValue

tests/test_blackjack.py:46–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44 '|_##| \n'
45
46def test_getCardValue():
47 # Test the pip card values:
48 for i in range(2, 11):
49 assert blackjack.getCardValue([(str(i), blackjack.HEARTS)]) == i
50
51 # Test the pip card values (multiple cards):
52 for i in range(2, 11):
53 for j in range(2, 11):
54 assert blackjack.getCardValue([(str(i), blackjack.HEARTS), (str(j), blackjack.HEARTS)]) == i + j
55
56 # Test the face cards:
57 for i in ('J', 'Q', 'K'):
58 assert blackjack.getCardValue([(i, blackjack.HEARTS)]) == 10
59
60 # Test the ace cards:
61 assert blackjack.getCardValue([('A', blackjack.HEARTS)]) == 11
62 assert blackjack.getCardValue([('A', blackjack.HEARTS), ('K', blackjack.HEARTS)]) == 21
63 assert blackjack.getCardValue([('A', blackjack.HEARTS), ('K', blackjack.HEARTS), ('K', blackjack.DIAMONDS)]) == 21
64 assert blackjack.getCardValue([('A', blackjack.HEARTS), ('6', blackjack.HEARTS), ('6', blackjack.DIAMONDS)]) == 13
65
66
67def test_getDeck():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected