1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 10:51:11 +01:00
thefuck/tests/rules/test_composer_not_command.py
mcarton 7f0f9a966f Fix some pep8 issues, mostly spaces
Before:
    4       E101 indentation contains mixed spaces and tabs
    20      E122 continuation line missing indentation or outdented
    1       E124 closing bracket does not match visual indentation
    12      E127 continuation line over-indented for visual indent
    22      E128 continuation line under-indented for visual indent
    2       E211 whitespace before '('
    12      E302 expected 2 blank lines, found 1
    1       E303 too many blank lines (3)
    4       E402 module level import not at top of file
    123     E501 line too long (81 > 79 characters)
    2       E731 do not assign a lambda expression, use a def
    3       W191 indentation contains tabs
    20      W291 trailing whitespace
    3       W293 blank line contains whitespace
    2       W391 blank line at end of file
    69      W503 line break before binary operator

After:
    20      E122 continuation line missing indentation or outdented
    12      E127 continuation line over-indented for visual indent
    22      E128 continuation line under-indented for visual indent
    123     E501 line too long (81 > 79 characters)
    2       E731 do not assign a lambda expression, use a def
    1       W291 trailing whitespace
    68      W503 line break before binary operator
2015-08-17 16:07:10 +02:00

58 lines
1.9 KiB
Python

import pytest
from thefuck.rules.composer_not_command import match, get_new_command
from tests.utils import Command
@pytest.fixture
def composer_not_command():
# that weird spacing is part of the actual command output
return (
'\n'
'\n'
' \n'
' [InvalidArgumentException] \n'
' Command "udpate" is not defined. \n'
' Did you mean this? \n'
' update \n'
' \n'
'\n'
'\n'
)
@pytest.fixture
def composer_not_command_one_of_this():
# that weird spacing is part of the actual command output
return (
'\n'
'\n'
' \n'
' [InvalidArgumentException] \n'
' Command "pdate" is not defined. \n'
' Did you mean one of these? \n'
' selfupdate \n'
' self-update \n'
' update \n'
' \n'
'\n'
'\n'
)
def test_match(composer_not_command, composer_not_command_one_of_this):
assert match(Command('composer udpate',
stderr=composer_not_command), None)
assert match(Command('composer pdate',
stderr=composer_not_command_one_of_this), None)
assert not match(Command('ls update', stderr=composer_not_command),
None)
def test_get_new_command(composer_not_command, composer_not_command_one_of_this):
assert get_new_command(Command('composer udpate',
stderr=composer_not_command), None) \
== 'composer update'
assert get_new_command(
Command('composer pdate', stderr=composer_not_command_one_of_this),
None) == 'composer selfupdate'