def test_compare_1(self): cards = [ Card("Spades", 2), Card("Clubs", 4), Card("Hearts", 5), Card("Diamonds", 7), ] h1 = deck.get_poker_hand(cards + [Card("Spades", "Ace")]) h2 = deck.get_poker_hand(cards + [Card("Spades", "King")]) assert h1 > h2
def test_compare_3(self): cards = [ Card("Diamonds", 6), Card("Spades", 9), Card("Clubs", "King"), ] h1 = deck.get_poker_hand( cards + [Card("Diamonds", 7), Card("Diamonds", "Queen")]) h2 = deck.get_poker_hand( cards + [Card("Hearts", 2), Card("Diamonds", "Jack")]) assert h1 > h2
def test_pair(self): cards = [ Card("Spades", 2), Card("Clubs", 4), Card("Hearts", 5), Card("Diamonds", 9), Card("Spades", 9), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.Pair, 9, 5)
def test_high_card_ace(self): cards = [ Card("Spades", 2), Card("Clubs", 4), Card("Hearts", 5), Card("Diamonds", 7), Card("Spades", "Ace"), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.HighCard, 14, 7, 5, 4, 2)
def test_straight_flush(self): cards = [ Card("Clubs", 5), Card("Clubs", 6), Card("Clubs", 7), Card("Clubs", 8), Card("Clubs", 9), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.StraightFlush, 9)
def test_straight_flush_with_low_ace(self): cards = [ Card("Clubs", 1), Card("Clubs", 2), Card("Clubs", 3), Card("Clubs", 4), Card("Clubs", 5), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.StraightFlush, 5)
def test_fours(self): cards = [ Card("Spades", 2), Card("Clubs", 9), Card("Hearts", 9), Card("Diamonds", 9), Card("Spades", 9), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.FourOfAKind, 9)
def test_full_house(self): cards = [ Card("Spades", 4), Card("Clubs", 4), Card("Hearts", 9), Card("Diamonds", 9), Card("Spades", 9), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.FullHouse, 9)
def test_flush(self): cards = [ Card("Clubs", 2), Card("Clubs", 4), Card("Clubs", 5), Card("Clubs", 7), Card("Clubs", 9), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.Flush, 9)
def test_straight_with_low_ace(self): cards = [ Card("Spades", 1), Card("Spades", 2), Card("Clubs", 3), Card("Hearts", 4), Card("Diamonds", 5), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.Straight, 5)
def test_triples(self): cards = [ Card("Spades", 2), Card("Clubs", 4), Card("Hearts", 9), Card("Diamonds", 9), Card("Spades", 9), ] hand = deck.get_poker_hand(cards) assert hand == (deck.PokerHand.ThreeOfAKind, 9, 4)