コード例 #1
0
ファイル: test_eval.py プロジェクト: ekr/pypoker-core
    def test_full_house(self):
        a = PokerHand()

        #case 1: make sure the empty hand isn't a full house
        self.assertFalse(a.is_full_house())

        #case 2: check an example full house
        a.add_cards('AdAhKsKdKh', None)
        self.assertTrue(a.is_full_house().primary == Card.CV_KING)
        self.assertTrue(a.is_full_house().type == HandValue.HV_FULL_HOUSE)
        self.assertTrue(a.is_full_house().secondary == Card.CV_ACE)

        #case 3: add a card which should reverse the primary and secondary
        a.add_cards(['As'], None)
        self.assertTrue(a.is_full_house().primary == Card.CV_ACE)
        self.assertTrue(a.is_full_house().type == HandValue.HV_FULL_HOUSE)
        self.assertTrue(a.is_full_house().secondary == Card.CV_KING)

        #case 4: make sure that two pair doesn't show up as a FH
        a = PokerHand()
        a.add_cards('5h5s4h4dAd', None)
        self.assertFalse(a.is_full_house())