def test_straight(self): """ Can we identify the highest straight in a hand """ pot = analyze.setup(self.table) analyze.order(pot) analyze.convert_to_card_value(pot) expected = [4, 14] self.assertEqual(expected, pot.players[4].hand)
def test_straight(self): """ Can we identify the highest straight in a hand """ pot = analyze.setup(self.table) analyze.order(pot) analyze.convert_to_card_value(pot) expected = [4, 14] self.assertEqual(expected, pot.players[4].hand)
def test_3_of_a_kind(self): """ Can we identify a hand with 3 of a kind in proper format? """ pot = analyze.setup(self.table) analyze.order(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) expected = [3, 5, 14, 12] self.assertEqual(expected, pot.players[5].hand)
def test_full_house(self): """ Can we identify a hand with a full house? """ pot = analyze.setup(self.table) analyze.order(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) expected = [6, 5, 10] self.assertEqual(expected, pot.players[2].hand)
def test_full_house(self): """ Can we identify a hand with a full house? """ pot = analyze.setup(self.table) analyze.order(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) expected = [6, 5, 10] self.assertEqual(expected, pot.players[2].hand)
def test_3_of_a_kind(self): """ Can we identify a hand with 3 of a kind in proper format? """ pot = analyze.setup(self.table) analyze.order(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) expected = [3, 5, 14, 12] self.assertEqual(expected, pot.players[5].hand)
def test_flush_returns_card_values(self): """ For all none flush hands do we return card values instead of card objects """ pot = analyze.setup(self.table) analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) for player in pot.players: if not player.hand: for card in player.hole_cards: self.assertIsInstance(card, int)
def test_award(self): """ can we award a single winner the entire pot? """ pot = analyze.setup(self.table) analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) analyze.award(pot, self.table.sb_amount) self.assertTrue(self.player1.stack == 200) self.assertTrue(len(pot.players) == 1)
def test_compare(self): """ Can we determine a single winner? """ pot = analyze.setup(self.table) analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) expected = self.player1 self.assertEqual(expected, pot.players[-1]) self.assertTrue(len(pot.players) == 1)
def test_wheel(self): """ Can we identify a wheel? """ pot = analyze.setup(self.table) pot.players[4].hole_cards[0].value = 14 pot.players[4].hole_cards[1].value = 4 self.table.community_cards[0].value = 3 self.table.community_cards[1].value = 2 analyze.order(pot) analyze.convert_to_card_value(pot) expected = [4, 5] self.assertEqual(expected, pot.players[4].hand)
def test_flush_returns_card_values(self): """ For all none flush hands do we return card values instead of card objects """ pot = analyze.setup(self.table) analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) for player in pot.players: if not player.hand: for card in player.hole_cards: self.assertIsInstance(card, int)
def test_award(self): """ can we award a single winner the entire pot? """ pot = analyze.setup(self.table) analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) analyze.award(pot, self.table.sb_amount) self.assertTrue(self.player1.stack == 200) self.assertTrue(len(pot.players) == 1)
def test_wheel(self): """ Can we identify a wheel? """ pot = analyze.setup(self.table) pot.players[4].hole_cards[0].value = 14 pot.players[4].hole_cards[1].value = 4 self.table.community_cards[0].value = 3 self.table.community_cards[1].value = 2 analyze.order(pot) analyze.convert_to_card_value(pot) expected = [4, 5] self.assertEqual(expected, pot.players[4].hand)
def test_compare(self): """ Can we determine a single winner? """ pot = analyze.setup(self.table) analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) expected = self.player1 self.assertEqual(expected, pot.players[-1]) self.assertTrue(len(pot.players) == 1)
def test_compare_multiple(self): """ if there are multiple winners do we return all of them? """ pot = analyze.setup(self.table) pot.players[1].hole_cards[0].value = 14 pot.players[1].hole_cards[0].suit = 'h' pot.players[1].hole_cards[1].value = 13 pot.players[1].hole_cards[1].suit = 'h' analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) expected = [self.player1, self.player2] self.assertEqual(expected, pot.players)
def test_compare_multiple(self): """ if there are multiple winners do we return all of them? """ pot = analyze.setup(self.table) pot.players[1].hole_cards[0].value = 14 pot.players[1].hole_cards[0].suit = 'h' pot.players[1].hole_cards[1].value = 13 pot.players[1].hole_cards[1].suit = 'h' analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) expected = [self.player1, self.player2] self.assertEqual(expected, pot.players)
def test_award_multiple(self): """ Can we pay out evenly to multiple winners """ pot = analyze.setup(self.table) pot.players[1].hole_cards[0].value = 14 pot.players[1].hole_cards[0].suit = 'h' pot.players[1].hole_cards[1].value = 13 pot.players[1].hole_cards[1].suit = 'h' analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) analyze.award(pot, self.table.sb_amount) expected = [self.player1, self.player2] self.assertEqual(expected, pot.players)
def test_award_multiple(self): """ Can we pay out evenly to multiple winners """ pot = analyze.setup(self.table) pot.players[1].hole_cards[0].value = 14 pot.players[1].hole_cards[0].suit = 'h' pot.players[1].hole_cards[1].value = 13 pot.players[1].hole_cards[1].suit = 'h' analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) analyze.award(pot, self.table.sb_amount) expected = [self.player1, self.player2] self.assertEqual(expected, pot.players)
def test_award_indivisible(self): """Can we properly pay pots that don't divide evenly?""" pot = analyze.setup(self.table) pot.amount = 101 pot.players[1].hole_cards[0].value = 14 pot.players[1].hole_cards[0].suit = 'h' pot.players[1].hole_cards[1].value = 13 pot.players[1].hole_cards[1].suit = 'h' analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) analyze.award(pot, self.table.sb_amount) expected1 = 151 expected2 = 150 self.assertEqual(expected1, pot.players[0].stack) self.assertEqual(expected2, pot.players[1].stack)
def test_award_indivisible(self): """Can we properly pay pots that don't divide evenly?""" pot = analyze.setup(self.table) pot.amount = 101 pot.players[1].hole_cards[0].value = 14 pot.players[1].hole_cards[0].suit = 'h' pot.players[1].hole_cards[1].value = 13 pot.players[1].hole_cards[1].suit = 'h' analyze.order(pot) analyze.flush(pot) analyze.convert_to_card_value(pot) analyze.matching(pot) analyze.compare(pot) analyze.award(pot, self.table.sb_amount) expected1 = 151 expected2 = 150 self.assertEqual(expected1, pot.players[0].stack) self.assertEqual(expected2, pot.players[1].stack)