Exemple #1
0
def test_not_a_card_should_throw_invalid_card_exception(test_input):
    with pytest.raises(InvalidCardException):
        analyzer.score_best_hand(test_input)


#---------------------------------------------

# @pytest.mark.parametrize("test_input,expected", [
#     (analyzer._to_cards(['AS', 'AH']), [analyzer._to_cards(['AS']), analyzer._to_cards(['AH'])]),
#     (analyzer._to_cards(['AS', 'AH', 'KS', 'KH', 'QS', 'QH', 'JS', 'JH', 'TS', 'TH']), [analyzer._to_cards(['AS', 'KS', 'QS', 'JS', 'TS']), analyzer._to_cards(['AH', 'KH', 'QH', 'JH', 'TH'])]),
# ])
# def test_find_best_straight_cards_finds_multiple_straights(test_input, expected):
#     actual = analyzer._find_best_straight_cards_t(test_input)

#     assert expected == actual

# ___________Hand Ranks____________
# HighCard       (1)
# Pair           (2)
# Two Pair       (3)
# Set            (4)
# Straight       (5)
# Flush          (6)
# Full House     (7)
# Quads          (8)
# Straight Flush (9)
# Royal Flush    (10)

# __________Suits__________
# Spade (S)(4)
# Club (C)(1)
# Heart (H)(3)
# Diamond (D)(2)

# __________Ranks__________
# a (1)
# 2 (2)
# 3 (3)
# 4 (4)
# 5 (5)
# 6 (6)
# 7 (7)
# 8 (8)
# 9 (9)
# T (10)
# J (11)
# Q (12)
# K (13)
# A (14)

# _________Result Code Brainstorm___________
# (['TS', 'AH', '4D', '3D', 'QC'], Result(1, 2422201413, ['AH', 'QC', 'TS', '4D', '3D'])),
# 01 14H 12C 10S 04D 03D
# 11 243 221 204 042 032 ***************
# 0114H12C10S04D03D
# 011412100403
# 112422201413
# 01:14H:12C:10S:04D:03D
Exemple #2
0
def test_straight(test_input, expected):
    actual = analyzer.score_best_hand(test_input)

    assert actual == expected
Exemple #3
0
def test_two_pair(test_input, expected):
    actual = analyzer.score_best_hand(test_input)

    assert actual == expected
Exemple #4
0
def test_five_or_less_cards_returned(test_input, expected):
    actual = analyzer.score_best_hand(test_input)

    assert len(actual.best_five) == expected
Exemple #5
0
def test_high_card(test_input, expected):
    actual = analyzer.score_best_hand(test_input)

    assert actual == expected
Exemple #6
0
def test_duplicate_cards_should_throw_duplicate_card_exception():
    with pytest.raises(DuplicateCardException):
        cards = ['2S', '2S']
        analyzer.score_best_hand(cards)
Exemple #7
0
def test_royal_flush(test_input, expected):
    actual = analyzer.score_best_hand(test_input)

    assert actual == expected
Exemple #8
0
def test_full_house(test_input, expected):
    actual = analyzer.score_best_hand(test_input)

    assert actual == expected
from HandAnalyzer import analyzer

cards = ['AS', 'JD']
cards
analyzer.score_best_hand(cards)


cards = ['1', '2', '3']
cards.append(cards.pop(0))
cards

cards = ['2S', '2C']
seen = set()
uniq = []
for x in cards:
    if x not in seen:
        uniq.append(x)
        seen.add(x)
    else:
        print('GOTCHA!')

seen

# %%
cards = ['2S', '2C', '3H', '3D', '4C', '4S', '5S', '5D', '6H', '6C', '7S', '7C']
cards.sort(reverse = True)
cards

#%%
if type(1) is not int:
    print(True)