1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-27 23:52:41 +01: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.scm_correction import match, get_new_command
from tests.utils import Command
from thefuck.types import Command
@pytest.fixture
@@ -9,19 +9,19 @@ def get_actual_scm_mock(mocker):
return_value=None)
@pytest.mark.parametrize('script, stderr, actual_scm', [
@pytest.mark.parametrize('script, output, actual_scm', [
('git log', 'fatal: Not a git repository '
'(or any of the parent directories): .git',
'hg'),
('hg log', "abort: no repository found in '/home/nvbn/exp/thefuck' "
"(.hg not found)!",
'git')])
def test_match(get_actual_scm_mock, script, stderr, actual_scm):
def test_match(get_actual_scm_mock, script, output, actual_scm):
get_actual_scm_mock.return_value = actual_scm
assert match(Command(script, stderr=stderr))
assert match(Command(script, output))
@pytest.mark.parametrize('script, stderr, actual_scm', [
@pytest.mark.parametrize('script, output, actual_scm', [
('git log', '', 'hg'),
('git log', 'fatal: Not a git repository '
'(or any of the parent directories): .git',
@@ -32,9 +32,9 @@ def test_match(get_actual_scm_mock, script, stderr, actual_scm):
('not-scm log', "abort: no repository found in '/home/nvbn/exp/thefuck' "
"(.hg not found)!",
'git')])
def test_not_match(get_actual_scm_mock, script, stderr, actual_scm):
def test_not_match(get_actual_scm_mock, script, output, actual_scm):
get_actual_scm_mock.return_value = actual_scm
assert not match(Command(script, stderr=stderr))
assert not match(Command(script, output))
@pytest.mark.parametrize('script, actual_scm, result', [
@@ -42,5 +42,5 @@ def test_not_match(get_actual_scm_mock, script, stderr, actual_scm):
('hg log', 'git', 'git log')])
def test_get_new_command(get_actual_scm_mock, script, actual_scm, result):
get_actual_scm_mock.return_value = actual_scm
new_command = get_new_command(Command(script))
new_command = get_new_command(Command(script, ''))
assert new_command == result