コード例 #1
0
    def test_get_value_four_of_a_kind(self):
        WinningHandTestCase.issue_cards(self.player1, [(4, 'Hearts'),
                                                       (4, 'Diamonds')])
        WinningHandTestCase.issue_cards(self.table,
                                        [(4, 'Spades'), (4, 'Clubs'),
                                         (6, 'Spades'), (2, 'Diamonds'),
                                         (8, 'Hearts')])

        winning_hand.get_value(self.table, self.player1)

        self.assertEqual(Hands.FOUR_OF_A_KIND, self.player1.get_hand())
コード例 #2
0
    def test_get_value_straight_flush(self):
        WinningHandTestCase.issue_cards(self.player1, [(9, 'Spades'),
                                                       (2, 'Clubs')])
        WinningHandTestCase.issue_cards(self.table, [(5, 'Spades'),
                                                     (6, 'Spades'),
                                                     (7, 'Spades'),
                                                     (8, 'Spades'),
                                                     (4, 'Hearts')])

        winning_hand.get_value(self.table, self.player1)

        self.assertEqual(Hands.STRAIGHT_FLUSH, self.player1.get_hand())
コード例 #3
0
    def test_get_value_royal_flush(self):
        WinningHandTestCase.issue_cards(self.player1, [(14, 'Spades'),
                                                       (2, 'Clubs')])
        WinningHandTestCase.issue_cards(self.table, [(10, 'Spades'),
                                                     (11, 'Spades'),
                                                     (12, 'Spades'),
                                                     (13, 'Spades'),
                                                     (4, 'Hearts')])

        winning_hand.get_value(self.table, self.player1)

        self.assertEqual(Hands.ROYAL_FLUSH, self.player1.get_hand())
コード例 #4
0
    def test_get_value_no_hand(self):
        WinningHandTestCase.issue_cards(self.player1, [(9, 'Clubs'),
                                                       (10, 'Diamonds')])
        WinningHandTestCase.issue_cards(self.table, [(4, 'Spades'),
                                                     (5, 'Spades'),
                                                     (6, 'Spades'),
                                                     (2, 'Diamonds'),
                                                     (8, 'Hearts')])

        winning_hand.get_value(self.table, self.player1)

        self.assertEqual(Hands.NO_HAND, self.player1.get_hand())
コード例 #5
0
    def test_get_value_two_pair(self):
        WinningHandTestCase.issue_cards(self.player1, [(4, 'Hearts'),
                                                       (5, 'Hearts')])
        WinningHandTestCase.issue_cards(self.table, [(4, 'Spades'),
                                                     (5, 'Spades'),
                                                     (6, 'Spades'),
                                                     (2, 'Diamonds'),
                                                     (8, 'Hearts')])

        winning_hand.get_value(self.table, self.player1)

        self.assertEqual(Hands.TWO_PAIR, self.player1.get_hand())
コード例 #6
0
    def test_get_value_flush(self):
        WinningHandTestCase.issue_cards(self.player1, [(14, 'Spades'),
                                                       (12, 'Spades')])
        WinningHandTestCase.issue_cards(self.table, [(4, 'Spades'),
                                                     (5, 'Spades'),
                                                     (6, 'Spades'),
                                                     (2, 'Diamonds'),
                                                     (8, 'Hearts')])

        winning_hand.get_value(self.table, self.player1)

        self.assertEqual(Hands.FLUSH, self.player1.get_hand())
コード例 #7
0
    def test_get_value_full_house(self):
        WinningHandTestCase.issue_cards(self.player1, [(2, 'Spades'),
                                                       (4, 'Hearts')])
        WinningHandTestCase.issue_cards(self.table, [(4, 'Spades'),
                                                     (5, 'Spades'),
                                                     (6, 'Spades'),
                                                     (2, 'Diamonds'),
                                                     (2, 'Clubs')])

        winning_hand.get_value(self.table, self.player1)

        self.assertEqual(Hands.FULL_HOUSE, self.player1.get_hand())