def test_Hand_isFullHouse(): assert euler54.Hand(royal_flush).isFullHouse() == False assert euler54.Hand(straight_flush).isFullHouse() == False assert euler54.Hand(four_of_a_kind).isFullHouse() == False assert euler54.Hand(full_house).isFullHouse() assert euler54.Hand(flush).isFullHouse() == False assert euler54.Hand(straight).isFullHouse() == False assert euler54.Hand(two_pair).isFullHouse() == False assert euler54.Hand(pair).isFullHouse() == False assert euler54.Hand(high_card).isFullHouse() == False assert euler54.Hand(three_of_a_kind).isFullHouse() == False
def test_Hand_isFlush(): # allowed to be true, because isFlush used to evaluate isRoyalFlush, and isStraightFlush # and isRoyalFlush and isStraightFlush will come before isFlush assert euler54.Hand(royal_flush).isFlush() assert euler54.Hand(straight_flush).isFlush() assert euler54.Hand(four_of_a_kind).isFlush() == False assert euler54.Hand(full_house).isFlush() == False assert euler54.Hand(flush).isFlush() assert euler54.Hand(straight).isFlush() == False assert euler54.Hand(three_of_a_kind).isFlush() == False assert euler54.Hand(two_pair).isFlush() == False assert euler54.Hand(pair).isFlush() == False assert euler54.Hand(high_card).isFlush() == False
def test_Hand_numberOfSuitsDict(): assert euler54.Hand([[1, 1], [2, 1], [3, 1], [4, 1], [5, 2]]).numberOfSuitsDict() == dict({ 1: 4, 2: 1 }) assert euler54.Hand([[1, 1], [2, 1], [3, 1], [4, 3], [5, 2]]).numberOfSuitsDict() == dict({ 1: 3, 3: 1, 2: 1, }) assert euler54.Hand([[1, 1], [2, 1], [3, 2], [4, 3], [5, 4]]).numberOfSuitsDict() == dict({ 1: 2, 2: 1, 3: 1, 4: 1 })
def test_Hand_numberOfPairsDict(): assert euler54.Hand([[1, 1], [1, 2], [2, 2], [3, 2], [4, 2]]).numberOfPairsDict() == dict({ 1: 2, 2: 1, 3: 1, 4: 1 }) assert euler54.Hand([[1, 1], [1, 2], [1, 3], [3, 2], [4, 2]]).numberOfPairsDict() == dict({ 1: 3, 3: 1, 4: 1 }) assert euler54.Hand([[1, 1], [1, 2], [1, 3], [1, 4], [4, 2]]).numberOfPairsDict() == dict({ 1: 4, 4: 1 })
def test_Hand_values(): assert euler54.Hand([[1, 1], [1, 2], [1, 3], [1, 4], [2, 1]]).values() == [1, 1, 1, 1, 2]
def test_Hand_suits(): assert euler54.Hand([[1, 1], [1, 2], [1, 3], [1, 4], [2, 1]]).suits() == [1, 2, 3, 4, 1]
def test_Hand_sortedExtraHighCards(): assert euler54.Hand(high_card).sortedExtraHighCards() == [10, 8, 6, 4, 2] assert euler54.Hand(pair).sortedExtraHighCards() == [5, 4, 2] assert euler54.Hand(two_pair).sortedExtraHighCards() == [5] assert euler54.Hand(three_of_a_kind).sortedExtraHighCards() == [3, 2]
def test_Hand_fourOfAKindSubWeight(): assert euler54.Hand(four_of_a_kind).fourOfAKindSubweight() == [1, 2]
def test_Hand_subWeightHandler(): assert euler54.Hand(pair).subWeightHandler() == [1, 5, 4, 2] assert euler54.Hand(two_pair).subWeightHandler() == [5] assert euler54.Hand(three_of_a_kind).subWeightHandler() == [3, 2] assert euler54.Hand(four_of_a_kind).subWeightHandler() == [1, 2]
def test_Hand_subWeight(): # work in progress assert euler54.Hand(royal_flush).subWeight() == [0] assert euler54.Hand(straight_flush).subWeight() == [13] assert euler54.Hand(four_of_a_kind).subWeight() == [1, 2] assert euler54.Hand(full_house).subWeight() == [2, 1] assert euler54.Hand(flush).subWeight() == [13, 12, 11, 10, 2] assert euler54.Hand(straight).subWeight() == [14] assert euler54.Hand(two_pair).subWeight() == [5] assert euler54.Hand(pair).subWeight() == [1, 5, 4, 2] assert euler54.Hand(high_card).subWeight() == [10, 8, 6, 4, 2] assert euler54.Hand(three_of_a_kind).subWeight() == [3, 2] assert euler54.Hand([[14, 4], [14, 1], [8, 3], [2, 3], [12, 1]]).subWeight() == [14, 12, 8, 2]
def test_Hand_weight(): assert euler54.Hand(royal_flush).weight() == 9 assert euler54.Hand(straight_flush).weight() == 8 assert euler54.Hand(four_of_a_kind).weight() == 7 assert euler54.Hand(full_house).weight() == 6 assert euler54.Hand(flush).weight() == 5 assert euler54.Hand(straight).weight() == 4 assert euler54.Hand(two_pair).weight() == 2 assert euler54.Hand(pair).weight() == 1 assert euler54.Hand(high_card).weight() == 0 assert euler54.Hand(three_of_a_kind).weight() == 3 assert euler54.Hand([[14, 4], [14, 1], [8, 3], [2, 3], [12, 1]]).weight() == 1