def test_four_of_kind(self): print("\tTESTING four of a kind...") hand = json.loads( '["7H", "7C", "7S", "5C", "7H"]' ) assert one(hand) == {'name': 'Four of a Kind', 'hand': ['7H', '7C', '7S', '5C', '7H'], 'value': None, 'kicker': 5} hand = json.loads( '["KH", "KC", "KS", "AC", "KH"]' ) assert one(hand) == {'name': 'Four of a Kind', 'hand': ['KH', 'KC', 'KS', 'AC', 'KH'], 'value': None, 'kicker': 'A'}
def test_highest(self): print("\tTESTING highest card...") hand = json.loads( '["JH", "4C", "5S", "KC", "9H"]' ) assert one(hand) == {'name': 'High Card', 'hand': ['JH', '4C', '5S', 'KC', '9H'], 'value': 'K', 'kicker': None} hand = json.loads( '["9H", "4C", "5S", "8C", "3S"]' ) assert one(hand) == {'name': 'High Card', 'hand': ['9H', '4C', '5S', '8C', '3S'], 'value': 9, 'kicker': None}
def test_mixed_straight(self): print("\tTESTING mixed numeric and non-numeric straights...") hand = json.loads( '["AH", "KH", "QD", "JC", "10C"]' ) assert one(hand) == {'name': 'Straight', 'hand': ['AH', 'KH', 'QD', 'JC', '10C'], 'value': None, 'kicker': None} hand = json.loads( '["KH", "QD", "JC", "10C", "9C"]' ) assert one(hand) == {'name': 'Straight', 'hand': ['KH', 'QD', 'JC', '10C', '9C'], 'value': None, 'kicker': None}
def test_straight_flush(self): print("\tTESTING straight flush...") hand = json.loads( '["8C", "7C", "6C", "5C", "4C"]' ) assert one(hand) == {'name': 'Straight Flush', 'hand': ['8C', '7C', '6C', '5C', '4C'], 'value': None, 'kicker': None} hand = json.loads( '["7S", "5S", "6S", "8S", "4S"]' ) assert one(hand) == {"name": "Straight Flush", "hand": ['7S', '5S', '6S', '8S', '4S'], "value": None, "kicker": None}
def test_one_pair(self): print("\tTESTING one pair...") hand = json.loads( '["JH", "4C", "5S", "JC", "9H"]' ) assert one(hand) == {'name': 'One Pair', 'hand': ['JH', '4C', '5S', 'JC', '9H'], 'value': None, 'kicker': 9}
def test_two_pair(self): print("\tTESTING two pair...") hand = json.loads( '["JH", "4C", "4S", "JC", "9H"]' ) assert one(hand) == {'name': 'Two Pair', 'hand': ['JH', '4C', '4S', 'JC', '9H'], 'value': None, 'kicker': 'J'}
def test_three_of_kind(self): print("\tTESTING three fo a kind...") hand = json.loads( '["7H", "7C", "5S", "JC", "7H"]' ) assert one(hand) == {'name': 'Three of a Kind', 'hand': ['7H', '7C', '5S', 'JC', '7H'], 'value': None, 'kicker': 'J'}
def test_straight(self): print("\tTESTING straights...") hand = json.loads( '["7H", "5H", "6C", "8C", "4C"]' ) assert one(hand) == {'name': 'Straight', 'hand': ['7H', '5H', '6C', '8C', '4C'], 'value': None, 'kicker': None}
def test_flush(self): print("\tTESTING flush...") hand = json.loads( '["9C", "7C", "5C", "6C", "10C"]' ) assert one(hand) == {'name': 'Flush', 'hand': ['9C', '7C', '5C', '6C', '10C'], 'value': None, 'kicker': None}
def test_full_house(self): print("\tTESTING full house...") hand = json.loads( '["7H", "7C", "5S", "5C", "7H"]' ) assert one(hand) == {'name': 'Full House', 'hand': ['7H', '7C', '5S', '5C', '7H'], 'value': None, 'kicker': None}
def test_royal_flush(self): print("\tTESTING royal flush...") hand = json.loads( '["AC", "KC", "QC", "JC", "10C"]' ) assert one(hand) == {'name': 'Royal Flush', 'hand': ['AC', 'KC', 'QC', 'JC', '10C'], 'value': None, 'kicker': None}