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)
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)
def test_basic(self): hand = Hand(**self._royal) transformed = hand.to_hdsc() self.assertEqual(transformed, self._royal_transformed["cards"])
def test_made_flush_doesnt_draw(self): hand = Hand(**self._made_flush) high, low = hand.has_flush_draw() self.assertFalse(high) self.assertFalse(low)
def test_flush_draw_both_cards(self): hand = Hand(**self._flush) high, low = hand.has_flush_draw() self.assertTrue(high) self.assertTrue(low)
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)
def test_top_pair(self): for hand_dict in (self._tptk, self._top): hand = Hand(**hand_dict) self.assertTrue(hand.has_top_pair())
def test_init_valid_hands(self): self._royal["evaluator"] = self.ev hand = Hand(**self._royal) self.assertEqual(hand.rank_class, 1)
def test_all_sets(self): for hand_dict in self._all_sets: hand = Hand(**hand_dict) self.assertTrue(hand.is_set())
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)
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)
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())
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())
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())
def test_line_2(self): hand = Hand(**self._line2) self.assertEqual(hand.to_hdsc(), self._line2_transform["cards"])
def test_all_pairs(self): for hand_dict in self._all_pairs: hand = Hand(**hand_dict) self.assertTrue(hand.is_one_pair())
def test_init_without_evaluator(self): hand = Hand(**self._royal) self.assertEqual(hand.rank_class, 1)