示例#1
0
def test_block(board):
    invoke(board, ['K', 2, 2, 3, 4, 'W'])
    assert string(board) == dedent('''\
        OOOO
        OWWO
        OWWO
        OWWO
        OOOO''')
示例#2
0
def test_horizontal(board):
    invoke(board, ['H', 2, 3, 3, 'W'])
    assert string(board) == dedent('''\
        OOOO
        OOOO
        OWWO
        OOOO
        OOOO''')
示例#3
0
def test_vertical(board):
    invoke(board, ['V', 2, 2, 4, 'W'])
    assert string(board) == dedent('''\
        OOOO
        OWOO
        OWOO
        OWOO
        OOOO''')
示例#4
0
def test_pixel(board):
    invoke(board, ['L', 2, 2, 'W'])
    assert string(board) == dedent('''\
        OOOO
        OWOO
        OOOO
        OOOO
        OOOO''')
示例#5
0
def test_fill(board):
    for n in range(1, 5):
        invoke(board, ['L', n, n, 'X'])
    invoke(board, ['F', 3, 2, '+'])
    assert string(board) == dedent('''\
        X+++
        OX++
        OOX+
        OOOX
        OOOO''')
示例#6
0
def test_clean():
    board = []
    invoke(board, ['I', 4, 5, 'X'])
    invoke(board, ['C'])
    assert string(board) == dedent('''\
        OOOO
        OOOO
        OOOO
        OOOO
        OOOO''')
示例#7
0
def board():
    board = []
    invoke(board, ['I', 4, 5])
    return board
示例#8
0
def test_save(board):
    with patch('builtins.open', spec=io.IOBase) as mock:
        invoke(board, ['S', 'out.bmp'])

    file = mock.return_value.__enter__.return_value
    file.write.assert_called_once_with(string(board))