Beispiel #1
0
    def test_transforms(self):
        for (hand_dict, transf_dict) in zip(self._hands,
                                            self._hands_transformed):
            hand = Hand(**hand_dict)
            should_be = transf_dict["cards"]

            self.assertEqual(hand.to_hdsc(), should_be)
Beispiel #2
0
 def test_flush_pair_in_hand(self):
     # Border case where there's a pair in hand.
     hand1 = Hand(**self._flush_high_card_pair1)
     hand2 = Hand(**self._flush_high_card_pair2)
     high1, low1 = hand1.has_flush_draw()
     high2, low2 = hand2.has_flush_draw()
     self.assertTrue(high1)
     self.assertFalse(low1)
     self.assertTrue(high2)
     self.assertFalse(low2)
Beispiel #3
0
    def test_basic(self):
        hand = Hand(**self._royal)
        transformed = hand.to_hdsc()

        self.assertEqual(transformed, self._royal_transformed["cards"])
Beispiel #4
0
 def test_made_flush_doesnt_draw(self):
     hand = Hand(**self._made_flush)
     high, low = hand.has_flush_draw()
     self.assertFalse(high)
     self.assertFalse(low)
Beispiel #5
0
 def test_flush_draw_both_cards(self):
     hand = Hand(**self._flush)
     high, low = hand.has_flush_draw()
     self.assertTrue(high)
     self.assertTrue(low)
Beispiel #6
0
 def test_flush_draw_low_card(self):
     hand = Hand(**self._flush_low_card)
     high, low = hand.has_flush_draw()
     self.assertTrue(low)
     self.assertFalse(high)
Beispiel #7
0
 def test_top_pair(self):
     for hand_dict in (self._tptk, self._top):
         hand = Hand(**hand_dict)
         self.assertTrue(hand.has_top_pair())
Beispiel #8
0
 def test_init_valid_hands(self):
     self._royal["evaluator"] = self.ev
     hand = Hand(**self._royal)
     self.assertEqual(hand.rank_class, 1)
Beispiel #9
0
 def test_all_sets(self):
     for hand_dict in self._all_sets:
         hand = Hand(**hand_dict)
         self.assertTrue(hand.is_set())
Beispiel #10
0
 def test_backdoor_flush_both_cards(self):
     hand = Hand(**self._bd_flush_both)
     high, low = hand.has_backdoor_flush()
     self.assertTrue(high)
     self.assertTrue(low)
Beispiel #11
0
 def test_backdoor_flush_low_card(self):
     hand = Hand(**self._bd_flush_low)
     high, low = hand.has_backdoor_flush()
     self.assertTrue(low)
     self.assertFalse(high)
Beispiel #12
0
 def test_suited_hands(self):
     suited = Hand(["As", "Ks"], ["2d", "3c", "5h"], self.ev)
     self.assertTrue(suited.hand_is_suited())
     not_suited = Hand(["As", "Kd"], ["2d", "3c", "5h"], self.ev)
     self.assertFalse(not_suited.hand_is_suited())
Beispiel #13
0
 def test_paired_board(self):
     paired = Hand(["Ts", "Td"], ["As", "Ad", "3c"])
     self.assertTrue(paired.paired_board())
     not_paired = Hand(["Ts", "Td"], ["As", "Kd", "3c"])
     self.assertFalse(not_paired.paired_board())
Beispiel #14
0
 def test_pocket_pair(self):
     pair = Hand(["Ts", "Td"], ["2d", "3c", "5h"], self.ev)
     self.assertTrue(pair.pair_in_hand())
     no_pair = Hand(["5d", "6d"], ["2d", "3c", "5h"], self.ev)
     self.assertFalse(no_pair.pair_in_hand())
Beispiel #15
0
 def test_line_2(self):
     hand = Hand(**self._line2)
     self.assertEqual(hand.to_hdsc(), self._line2_transform["cards"])
Beispiel #16
0
 def test_all_pairs(self):
     for hand_dict in self._all_pairs:
         hand = Hand(**hand_dict)
         self.assertTrue(hand.is_one_pair())
Beispiel #17
0
 def test_init_without_evaluator(self):
     hand = Hand(**self._royal)
     self.assertEqual(hand.rank_class, 1)