Exemplo n.º 1
0
def test_straight_flush():
    sorted_hands = ["sorted hand0 : Ah H, K H, Q H, J H, 10 H"]
    real_hands_rank = set(["hand rank : hand0 : straight_flush : Ah H, K H, Q H, J H, 10 H"])
    sorted_hand_assertions = sorted_hands + BASE_ASSERTIONS
    hands_rank = set(get_hands_from_assertions(
            "hand rank : (?p) : (?r)",
            get_classified_hands_assertions(sorted_hand_assertions)))
    assert hands_rank == real_hands_rank
Exemplo n.º 2
0
def test_straight():
    sorted_hands = ["sorted hand0 : 5 S, 4 H, 3 C, 2 D, Al D"]
    real_hands_rank = set(["hand rank : hand0 : straight : 5 S, 4 H, 3 C, 2 D, Al D"])
    sorted_hand_assertions = sorted_hands + BASE_ASSERTIONS
    hands_rank = set(get_hands_from_assertions(
            "hand rank : (?p) : (?r)",
            get_classified_hands_assertions(sorted_hand_assertions)))
    assert hands_rank == real_hands_rank
Exemplo n.º 3
0
def test_high_card():
    sorted_hands = ["sorted hand0 : Ah S, J H, 8 C, 3 H, Al D"]
    real_hands_rank = set(["hand rank : hand0 : high_card : Ah S, J H, 8 C, 3 H, Al D"])
    sorted_hand_assertions = sorted_hands + BASE_ASSERTIONS
    hands_rank = set(get_hands_from_assertions(
            "hand rank : (?p) : (?r)",
            get_classified_hands_assertions(sorted_hand_assertions)))
    assert hands_rank == real_hands_rank
Exemplo n.º 4
0
def test_full_house():
    sorted_hands = ["sorted hand0 : Ah S, Ah H, Ah C, 10 H, 10 D",
                    "sorted hand1 : 10 S, 10 H, 9 H, 9 C, 9 D"]
    real_hands_rank = set(["hand rank : hand0 : full_house : Ah S, Ah H, Ah C, 10 H, 10 D",
                           "hand rank : hand1 : full_house : 9 H, 9 C, 9 D, 10 S, 10 H"])
    sorted_hand_assertions = sorted_hands + BASE_ASSERTIONS
    hands_rank = set(get_hands_from_assertions(
            "hand rank : (?p) : (?r)",
            get_classified_hands_assertions(sorted_hand_assertions)))
    assert hands_rank == real_hands_rank
Exemplo n.º 5
0
def test_four_of_a_kind():
    sorted_hands = ["sorted hand0 : Ah S, Ah H, Ah C, Ah D, 10 H",
                    "sorted hand1 : 10 H, 9 S, 9 H, 9 C, 9 D"]
    real_hands_rank = set(["hand rank : hand0 : four_of_a_kind : Ah S, Ah H, Ah C, Ah D, 10 H",
                           "hand rank : hand1 : four_of_a_kind : 9 S, 9 H, 9 C, 9 D, 10 H"])
    sorted_hand_assertions = sorted_hands + BASE_ASSERTIONS
    hands_rank = set(get_hands_from_assertions(
            "hand rank : (?p) : (?r)",
            get_classified_hands_assertions(sorted_hand_assertions)))
    assert hands_rank == real_hands_rank
Exemplo n.º 6
0
def test_two_pair():
    sorted_hands = ["sorted hand0 : Ah S, Ah H, 10 C, 10 H, 9 D",
                    "sorted hand1 : K S, K H, 10 H, 9 C, 9 D",
                    "sorted hand2 : Ah S, 10 S, 10 H, 9 C, 9 D"]
    real_hands_rank = set(["hand rank : hand0 : two_pair : Ah S, Ah H, 10 C, 10 H, 9 D",
                           "hand rank : hand1 : two_pair : K S, K H, 9 C, 9 D, 10 H",
                           "hand rank : hand2 : two_pair : 10 S, 10 H, 9 C, 9 D, Ah S"])
    sorted_hand_assertions = sorted_hands + BASE_ASSERTIONS
    hands_rank = set(get_hands_from_assertions(
            "hand rank : (?p) : (?r)",
            get_classified_hands_assertions(sorted_hand_assertions)))
    assert hands_rank == real_hands_rank
Exemplo n.º 7
0
def test_three_of_a_kind():
    sorted_hands = ["sorted hand0 : Ah S, Ah H, Ah C, 10 H, 9 D",
                    "sorted hand1 : K S, 10 S, 10 H, 10 C, 9 D",
                    "sorted hand2 : Ah S, 10 H, 9 S, 9 C, 9 D"]
    real_hands_rank = set(["hand rank : hand0 : three_of_a_kind : Ah S, Ah H, Ah C, 10 H, 9 D",
                           "hand rank : hand1 : three_of_a_kind : 10 S, 10 H, 10 C, K S, 9 D",
                           "hand rank : hand2 : three_of_a_kind : 9 S, 9 C, 9 D, Ah S, 10 H"])
    sorted_hand_assertions = sorted_hands + BASE_ASSERTIONS
    hands_rank = set(get_hands_from_assertions(
            "hand rank : (?p) : (?r)",
            get_classified_hands_assertions(sorted_hand_assertions)))
    assert hands_rank == real_hands_rank
Exemplo n.º 8
0
def test_one_pair():
    sorted_hands = ["sorted hand0 : 9 S, 9 H, 8 C, 7 H, 6 D",
                    "sorted hand1 : 9 S, 8 H, 8 C, 7 H, 6 D",
                    "sorted hand2 : 9 S, 8 H, 7 H, 7 C, 6 D",
                    "sorted hand3 : 9 S, 8 H, 7 C, 6 H, 6 D"]
    real_hands_rank = set(["hand rank : hand0 : one_pair : 9 S, 9 H, 8 C, 7 H, 6 D",
                           "hand rank : hand1 : one_pair : 8 H, 8 C, 9 S, 7 H, 6 D",
                           "hand rank : hand2 : one_pair : 7 H, 7 C, 9 S, 8 H, 6 D",
                           "hand rank : hand3 : one_pair : 6 H, 6 D, 9 S, 8 H, 7 C"])
    sorted_hand_assertions = sorted_hands + BASE_ASSERTIONS
    hands_rank = set(get_hands_from_assertions(
            "hand rank : (?p) : (?r)",
            get_classified_hands_assertions(sorted_hand_assertions)))
    assert hands_rank == real_hands_rank