Example #1
0
 def test_highcard_compare(self):
     d = self.d
     highcard1 = Hand.get_highcard([d.h8, d.cj, d.ck, d.d9, d.d7])
     highcard2 = Hand.get_highcard([d.c8, d.d5, d.ck, d.d9, d.d7])
     highcard3 = Hand.get_highcard([d.ca, d.dj, d.ck, d.d9, d.d7])
     assert(highcard1 is not None)
     assert(highcard1 > highcard2 and highcard2 < highcard1)
     assert(highcard2 < highcard3 and highcard3 > highcard2)
     assert(highcard3 > highcard1 and highcard1 < highcard3)
Example #2
0
 def test_different_categories_compare(self):
     d = self.d
     hands = [Hand.get_highcard([d.h6, d.c9, d.d2, d.ck, d.cj]),
              Hand.get_pair([d.cj, d.sq, d.d2, d.c2, d.s4]),
              Hand.get_twopair([d.sj, d.cq, d.da, d.dq, d.hj]),
              Hand.get_threeofakind([d.d3, d.h8, d.c4, d.d8, d.s8]),
              Hand.get_straight([d.d7, d.h4, d.c5, d.c3, d.d6]),
              Hand.get_flush([d.h4, d.h8, d.h5, d.hq, d.h2]),
              Hand.get_fullhouse([d.d8, d.c8, d.s6, d.s8, d.c6]),
              Hand.get_fourofakind([d.h9, d.c7, d.d9, d.c9, d.s9]),
              Hand.get_straightflush([d.c3, d.c5, d.c4, d.c2, d.c6])]
     for hand in hands:
         assert(hand is not None)
     for hand1, hand2 in combinations(hands, 2):
         assert(hand1 < hand2)
     hands.reverse()
     for hand1, hand2 in combinations(hands, 2):
         assert(hand1 > hand2)
Example #3
0
 def test_highcard(self):
     d = self.d
     hand = Hand.get_highcard([d.hk, d.da, d.hq, d.dk, d.cj])
     assert(hand is not None and hand.category == Hand.HIGHCARD)