コード例 #1
0
ファイル: poker_tests.py プロジェクト: Unoblueboy/MIT-6.034
def test_winning_hand_one_pair_4():
    ranked_hands = ["hand rank : hand0 : one_pair : K S, K H, J C, 8 H, 5 D",
                    "hand rank : hand1 : one_pair : Ah S, Ah H, J C, 8 H, 5 D"]
    ranked_hands_assertions = ranked_hands + BASE_ASSERTIONS
    real_winners = set(["winner hand1"])
    winners = set(get_hands_from_assertions(
            "winner",
            get_winning_hand_assertions(ranked_hands_assertions),
            suffix = " (?p)"))
    assert winners == real_winners
コード例 #2
0
ファイル: poker_tests.py プロジェクト: Unoblueboy/MIT-6.034
def test_winning_hand_high_card_5():
    ranked_hands = ["hand rank : hand0 : high_card : K S, J H, 8 C, 3 H, Al D",
                    "hand rank : hand1 : high_card : Ah D, J D, 8 D, 3 D, Al S"
            ]
    ranked_hands_assertions = ranked_hands + BASE_ASSERTIONS
    real_winners = set(["winner hand1"])
    winners = set(get_hands_from_assertions(
            "winner",
            get_winning_hand_assertions(ranked_hands_assertions),
            suffix = " (?p)"))
    assert winners == real_winners
コード例 #3
0
ファイル: poker_tests.py プロジェクト: Unoblueboy/MIT-6.034
def test_winning_hand_dif_ranks():
    ranked_hands = ["hand rank : hand0 : high_card : Ah S, J H, 8 C, 3 H, Al D",
                    "hand rank : hand1 : straight : 5 S, 4 H, 3 C, 2 D, Al D"
            ]
    ranked_hands_assertions = ranked_hands + BASE_ASSERTIONS
    real_winners = set(["winner hand1"])
    winners = set(get_hands_from_assertions(
            "winner",
            get_winning_hand_assertions(ranked_hands_assertions),
            suffix = " (?p)"))
    assert winners == real_winners