1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-30 14:44:05 +00:00

#682: Unify work with output in classic and instant mode

This commit is contained in:
Vladimir Iakovlev
2017-08-31 17:58:56 +02:00
parent 96843fc6cd
commit 4625d8503d
237 changed files with 1322 additions and 1332 deletions

View File

@@ -1,6 +1,6 @@
import pytest
from thefuck.rules.ln_s_order import match, get_new_command
from tests.utils import Command
from thefuck.types import Command
@pytest.fixture
@@ -8,17 +8,17 @@ def file_exists(mocker):
return mocker.patch('os.path.exists', return_value=True)
get_stderr = "ln: failed to create symbolic link '{}': File exists".format
get_output = "ln: failed to create symbolic link '{}': File exists".format
@pytest.mark.parametrize('script, stderr, exists', [
('ln dest source', get_stderr('source'), True),
('ls -s dest source', get_stderr('source'), True),
@pytest.mark.parametrize('script, output, exists', [
('ln dest source', get_output('source'), True),
('ls -s dest source', get_output('source'), True),
('ln -s dest source', '', True),
('ln -s dest source', get_stderr('source'), False)])
def test_not_match(file_exists, script, stderr, exists):
('ln -s dest source', get_output('source'), False)])
def test_not_match(file_exists, script, output, exists):
file_exists.return_value = exists
assert not match(Command(script, stderr=stderr))
assert not match(Command(script, output))
@pytest.mark.usefixtures('file_exists')
@@ -27,6 +27,6 @@ def test_not_match(file_exists, script, stderr, exists):
('ln dest -s source', 'ln -s source dest'),
('ln dest source -s', 'ln source -s dest')])
def test_match(script, result):
stderr = get_stderr('source')
assert match(Command(script, stderr=stderr))
assert get_new_command(Command(script, stderr=stderr)) == result
output = get_output('source')
assert match(Command(script, output))
assert get_new_command(Command(script, output)) == result