コード例 #1
0
def test_valid_play_same_number():
    assert game.valid_play([game.Card(5, 'D')], [game.Card(5, 'H')])
    assert game.valid_play(
        [game.Card(5, 'D')],
        [game.Card(5, 'H'), game.Card(5, 'S')])
    assert not game.valid_play([game.Card(
        5, 'D')], [game.Card(5, 'H'), game.Card(8, 'S')])
コード例 #2
0
def test_valid_play_seven():
    assert game.valid_play([game.Card(7, 'D')], [game.Card(4, 'H')])
    assert game.valid_play([game.Card(7, 'D')], [game.Card(5, 'H')])
    assert game.valid_play([game.Card(7, 'D')], [game.Card(6, 'H')])
    assert game.valid_play([game.Card(7, 'D')], [game.Card(7, 'H')])
    assert not game.valid_play([game.Card(7, 'D')], [game.Card(11, 'H')])
    assert not game.valid_play([game.Card(7, 'D')], [game.Card(1, 'H')])

    assert game.valid_play([game.Card(7, 'D')], [game.Card(2, 'H')])
    assert game.valid_play([game.Card(7, 'D')], [game.Card(3, 'H')])
    assert game.valid_play([game.Card(7, 'D')], [game.Card(10, 'H')])
コード例 #3
0
def test_valid_play_special_cards():
    assert game.valid_play([game.Card(5, 'D')], [game.Card(2, 'H')])
    assert game.valid_play([game.Card(5, 'D')], [game.Card(3, 'H')])
    assert game.valid_play([game.Card(5, 'D')], [game.Card(10, 'H')])
コード例 #4
0
def test_valid_play_mismatched_played_cards():
    SOME_PILE = [game.Card(12, 'S')]
    assert not game.valid_play(
        SOME_PILE, [game.Card(5, 'H'), game.Card(6, 'H')])
    assert not game.valid_play(
        SOME_PILE, [game.Card(5, 'S'), game.Card(6, 'H')])
コード例 #5
0
def test_valid_play_higher_number():
    assert game.valid_play([game.Card(10, 'D')], [game.Card(11, 'H')])
    assert game.valid_play([game.Card(10, 'D')], [game.Card(12, 'H')])
    assert game.valid_play([game.Card(10, 'D')], [game.Card(13, 'H')])
    assert game.valid_play([game.Card(10, 'D')], [game.Card(1, 'H')])
    assert not game.valid_play([game.Card(10, 'D')], [game.Card(4, 'H')])
コード例 #6
0
def test_valid_play_no_pile():
    assert game.valid_play([], [game.Card(5, 'H')])
    assert game.valid_play([], [game.Card(5, 'H'), game.Card(5, 'S')])