1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00
thefuck/tests/rules/test_pip_unknown_command.py

25 lines
754 B
Python
Raw Normal View History

2015-04-23 07:25:12 +01:00
import pytest
from thefuck.rules.pip_unknown_command import match, get_new_command
from tests.utils import Command
2015-04-23 07:25:12 +01:00
@pytest.fixture
def pip_unknown_cmd():
return '''ERROR: unknown command "instatl" - maybe you meant "install"'''
@pytest.fixture
def pip_unknown_cmd_without_recommend():
return '''ERROR: unknown command "i"'''
def test_match(pip_unknown_cmd, pip_unknown_cmd_without_recommend):
assert match(Command('pip instatl', stderr=pip_unknown_cmd))
assert not match(Command('pip i',
stderr=pip_unknown_cmd_without_recommend))
2015-04-23 07:25:12 +01:00
def test_get_new_command(pip_unknown_cmd):
assert get_new_command(Command('pip instatl',
stderr=pip_unknown_cmd)) == 'pip install'