Exemple #1
0
def test_straight():
    straight_ex = [
        ("hearts", "Ace"),
        ("diamonds", "King"),
        ("diamonds", "Queen"),
        ("diamonds", "Jack"),
        ("diamonds", 10),
        ("spades", 2),
        ("clubs", "Ace"),
    ]
    res = choose_cards(straight_ex)
    assert res[0] == "straight"
    assert res[1] == [
        ("hearts", "Ace"),
        ("diamonds", "King"),
        ("diamonds", "Queen"),
        ("diamonds", "Jack"),
        ("diamonds", 10),
    ]

    straight_ex = [
        ("spades", 3),
        ("clubs", 2),
        ("hearts", "Ace"),
        ("diamonds", "King"),
        ("diamonds", "Queen"),
        ("diamonds", "Jack"),
        ("diamonds", 10),
    ]
    res = choose_cards(straight_ex)
    assert res[0] == "straight"
    assert res[1] == [
        ("hearts", "Ace"),
        ("diamonds", "King"),
        ("diamonds", "Queen"),
        ("diamonds", "Jack"),
        ("diamonds", 10),
    ]
Exemple #2
0
def test_flush():
    flush_ex = [
        ("diamonds", 2),
        ("diamonds", "King"),
        ("diamonds", "Queen"),
        ("diamonds", "Jack"),
        ("diamonds", 10),
        ("spades", 2),
        ("clubs", "Ace"),
    ]
    res = choose_cards(flush_ex)
    assert res[0] == "flush"
    assert res[1] == [
        ("diamonds", "King"),
        ("diamonds", "Queen"),
        ("diamonds", "Jack"),
        ("diamonds", 10),
        ("diamonds", 2),
    ]
Exemple #3
0
def test_straight_flush2():
    straight_flush_ex2 = [
        ("clubs", "Ace"),
        ("diamonds", "King"),
        ("diamonds", "Queen"),
        ("diamonds", "Jack"),
        ("diamonds", 10),
        ("diamonds", 9),
        ("diamonds", 8),
    ]
    res = choose_cards(straight_flush_ex2)
    assert res[0] == "straight_flush"
    assert res[1] == [
        ("diamonds", "King"),
        ("diamonds", "Queen"),
        ("diamonds", "Jack"),
        ("diamonds", 10),
        ("diamonds", 9),
    ]