-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_determine_winner.py
37 lines (24 loc) · 1.14 KB
/
test_determine_winner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Test blackjack.determine_winner"""
import blackjack
def test_determine_winner_when_player_score_higher():
assert blackjack.determine_winner(
dealer_hand_value=20, player_hand_value=21) == blackjack.PLAYER
def test_determine_winner_when_dealer_score_higher():
assert blackjack.determine_winner(
dealer_hand_value=21, player_hand_value=20) == blackjack.DEALER
def test_determine_winner_when_tie_score():
assert blackjack.determine_winner(
dealer_hand_value=19, player_hand_value=19) == blackjack.TIE
def test_determine_winner_when_dealer_busted():
assert blackjack.determine_winner(
dealer_hand_value=22, player_hand_value=19) == blackjack.PLAYER
def test_determine_winner_when_player_busted():
assert blackjack.determine_winner(
dealer_hand_value=20, player_hand_value=22) == blackjack.DEALER
def test_determine_winner_when_player_dealer_busted():
try:
blackjack.determine_winner(
dealer_hand_value=22, player_hand_value=22) == blackjack.DEALER
assert False, 'Expected blackjack.BlackjackException'
except blackjack.BlackjackException:
assert True