Exemplo n.º 1
0
 def test_not_straight(self):
     hand = [
         Card("2", "Clubs"),
         Card("3", "Diamonds"),
         Card("4", "Hearts"),
         Card("5", "Diamonds")
     ]
     ranks = CheckRanks(hand)
     straight = Straight(ranks.list_ranks, ranks.list_suits)
     self.assertEqual(straight.is_valid, False)
Exemplo n.º 2
0
 def test_straight_and_extra(self):
     hand = [
         Card("2", "Clubs"),
         Card("3", "Diamonds"),
         Card("4", "Hearts"),
         Card("5", "Diamonds"),
         Card("Queen", "Diamonds"),
         Card("Ace", "Diamonds"),
         Card("6", "Diamonds")
     ]
     ranks = CheckRanks(hand)
     straight = Straight(ranks.list_ranks, ranks.list_suits)
     self.assertEqual(straight.is_valid, True)
Exemplo n.º 3
0
 def test_straight_flush_return(self):
     hand = [
         Card("2", "Diamonds"),
         Card("3", "Diamonds"),
         Card("4", "Diamonds"),
         Card("5", "Diamonds"),
         Card("7", "Clubs"),
         Card("8", "Clubs"),
         Card("6", "Diamonds"),
     ]
     expected_hand = [
         Card("6", "Diamonds"),
         Card("5", "Diamonds"),
         Card("4", "Diamonds"),
         Card("3", "Diamonds"),
         Card("2", "Diamonds"),
     ]
     ranks = CheckRanks(hand)
     straight = Straight(ranks.list_ranks, ranks.list_suits)
     self.assertEqual(straight.high_straight, expected_hand)
Exemplo n.º 4
0
 def test_straight_return_higher(self):
     hand = [
         Card("9", "Diamonds"),
         Card("3", "Diamonds"),
         Card("4", "Diamonds"),
         Card("5", "Diamonds"),
         Card("7", "Clubs"),
         Card("8", "Clubs"),
         Card("6", "Diamonds"),
     ]
     expected_hand = [
         Card("9", "Diamonds"),
         Card("5", "Diamonds"),
         Card("7", "Clubs"),
         Card("8", "Clubs"),
         Card("6", "Diamonds"),
     ]
     expected_hand.sort(reverse=True)
     ranks = CheckRanks(hand)
     straight = Straight(ranks.list_ranks, ranks.list_suits)
     self.assertEqual(straight.high_straight, expected_hand)
Exemplo n.º 5
0
 def _check_for_straight(self, ranks, suits):
     straight = Straight(ranks, suits)
     if straight.is_valid:
         self._cards_in_hand = straight.cards
         self._set_hand("Straight", straight.value, straight.cards)