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

        #case 1:  make sure the empty hand is not a straight flush
        self.assertFalse(x.is_str_flush())

        #case 2:  make sure four to a straight flush is not a straight flush
        x.add_cards('AhKhQhJh', None)
        self.assertFalse(x.is_str_flush())

        #case 3: make sure we find the ace high straight flush
        x.add_cards(['Th'], None)
        out = x.is_str_flush()
        self.assertTrue(out.type == HandValue.HV_STR_FLUSH)
        self.assertTrue(out.primary == Card.CV_ACE)
        self.assertTrue(out.secondary == Card.SV_HEARTS)

        #case 4: extend the str flush on the low end, make sure it doens't change
        x.add_cards(['9h'], None)
        self.assertTrue(x.is_str_flush().primary == Card.CV_ACE)

        y = PokerHand()

        #case 5: check that the wheel works
        y.add_cards('Ad2d3d4d5d', None)
        self.assertTrue(y.is_str_flush().primary == Card.CV_FIVE)

        #case 6: add the 6, make sure it changes
        y.add_cards(['6d'], None)
        self.assertTrue(y.is_str_flush().primary == Card.CV_SIX)

        #case 7: make sure that a flush is not a straight flush
        z = PokerHand()
        z.add_cards('AcJcTc9c8c', None)
        self.assertFalse(z.is_str_flush())

        #case 8: make it a straight and flush, but not str_flush
        z.add_cards(['7d'], None)
        self.assertFalse(z.is_str_flush())