示例#1
0
    def test_straight(self):
        cards = [
            Card(4, Suit.hearts),
            Card(5, Suit.clubs),
            Card(6, Suit.clubs),
            Card(7, Suit.clubs),
            Card(8, Suit.clubs)
        ]
        self.assertEqual(Hand(cards).type, HandType.straight)
    
        cards = [
            Card(1, Suit.hearts),
            Card(2, Suit.clubs),
            Card(3, Suit.clubs),
            Card(4, Suit.clubs),
            Card(5, Suit.clubs)
        ]
        self.assertEqual(Hand(cards).type, HandType.straight)

        cards = [
            Card(1, Suit.hearts),
            Card(10, Suit.clubs),
            Card(11, Suit.clubs),
            Card(12, Suit.clubs),
            Card(13, Suit.clubs)
        ]
        self.assertEqual(Hand(cards).type, HandType.straight)
示例#2
0
 def test_side_pair(self):
     cards = [
         Card(2, Suit.hearts),
         Card(2, Suit.spades),
         Card(3, Suit.diamonds)
     ] 
     self.assertEqual(Hand(cards).type_side, HandType.pair_side)
示例#3
0
 def test_side_three_of_kind(self):
     cards = [
         Card(2, Suit.hearts),
         Card(2, Suit.diamonds),
         Card(2, Suit.spades)
     ]
     self.assertEqual(Hand(cards).type_side, HandType.three_of_kind_side)
示例#4
0
 def test_side_flush(self):
     cards = [
         Card(2, Suit.hearts),
         Card(4, Suit.hearts),
         Card(6, Suit.hearts)
     ] 
     self.assertEqual(Hand(cards).type_side, HandType.flush_side)
示例#5
0
 def test_side_royal(self):
     cards = [
         Card(11, Suit.hearts),
         Card(12, Suit.hearts),
         Card(13, Suit.hearts)
     ]
     self.assertEqual(Hand(cards).type_side, HandType.mini_royal)
示例#6
0
 def test_three_of_kind(self):
     cards = [
         Card(1, Suit.hearts),
         Card(1, Suit.clubs),
         Card(1, Suit.diamonds),
         Card(2, Suit.clubs),
         Card(3, Suit.clubs)
     ]
     self.assertEqual(Hand(cards).type, HandType.three_of_kind)
示例#7
0
 def test_flush(self):
     cards = [
         Card(2, Suit.clubs),
         Card(4, Suit.clubs),
         Card(6, Suit.clubs),
         Card(8, Suit.clubs),
         Card(10, Suit.clubs)
     ]
     self.assertEqual(Hand(cards).type, HandType.flush)
示例#8
0
 def test_full_house(self):
     cards = [
         Card(4, Suit.clubs),
         Card(4, Suit.hearts),
         Card(4, Suit.diamonds),
         Card(8, Suit.spades),
         Card(8, Suit.clubs)
     ]
     self.assertEqual(Hand(cards).type, HandType.full_house)
示例#9
0
 def test_four_of_kind(self):
     cards = [
         Card(4, Suit.clubs),
         Card(4, Suit.hearts),
         Card(4, Suit.diamonds),
         Card(4, Suit.spades),
         Card(8, Suit.clubs)
     ]
     self.assertEqual(Hand(cards).type, HandType.four_of_kind)
示例#10
0
 def test_straight_flush(self):
     cards = [
         Card(4, Suit.clubs),
         Card(5, Suit.clubs),
         Card(6, Suit.clubs),
         Card(7, Suit.clubs),
         Card(8, Suit.clubs)
     ]
     self.assertEqual(Hand(cards).type, HandType.straight_flush)
示例#11
0
    def test_payout(self):
        cards = [
            Card(3, Suit.hearts),
            Card(5, Suit.clubs),
            Card(6, Suit.diamonds),
            Card(7, Suit.clubs),
            Card(8, Suit.clubs)
        ]
        self.assertEqual(Hand(cards).payout(1), 0)

        cards = [
            Card(1, Suit.hearts),
            Card(1, Suit.clubs),
            Card(1, Suit.diamonds),
            Card(2, Suit.clubs),
            Card(3, Suit.clubs)
        ]
        self.assertEqual(Hand(cards).payout(1), 3 + 1)
示例#12
0
 def test_royal_flush(self):
     cards = [
         Card(1, Suit.clubs),
         Card(10, Suit.clubs),
         Card(11, Suit.clubs),
         Card(12, Suit.clubs),
         Card(13, Suit.clubs)
     ]
     self.assertEqual(Hand(cards).type, HandType.royal_flush)
示例#13
0
 def test_high(self):
     cards = [
         Card(3, Suit.hearts),
         Card(5, Suit.clubs),
         Card(6, Suit.diamonds),
         Card(7, Suit.clubs),
         Card(8, Suit.clubs)
     ]
     self.assertEqual(Hand(cards).type, HandType.high)
示例#14
0
 def test_pair(self):
     cards = [
         Card(1, Suit.hearts),
         Card(2, Suit.clubs),
         Card(2, Suit.diamonds),
         Card(3, Suit.clubs),
         Card(4, Suit.clubs)
     ]
     self.assertEqual(Hand(cards).type, HandType.pair)
示例#15
0
    def test_side_straight(self):
        cards = [
            Card(4, Suit.hearts),
            Card(5, Suit.diamonds),
            Card(6, Suit.spades)
        ]
        self.assertEqual(Hand(cards).type_side, HandType.straight_side)

        cards = [
            Card(12, Suit.hearts),
            Card(13, Suit.diamonds),
            Card(1, Suit.spades)
        ]
        self.assertEqual(Hand(cards).type_side, HandType.straight_side)

        cards = [
            Card(1, Suit.hearts),
            Card(2, Suit.diamonds),
            Card(3, Suit.spades)
        ]
        self.assertEqual(Hand(cards).type_side, HandType.straight_side)