1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-19 11:42:33 +01:00

Add a support for pip unknown commands

This commit is contained in:
Namwoo Kim
2015-04-23 15:25:12 +09:00
parent 0272e8a801
commit af2bfe7c58
2 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import pytest
from thefuck.types import Command
from thefuck.rules.pip_unknown_command import match, get_new_command
@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', '', pip_unknown_cmd), None)
assert not match(Command('pip i', '', pip_unknown_cmd_without_recommend),
None)
def test_get_new_command(pip_unknown_cmd):
assert get_new_command(Command('pip instatl', '', pip_unknown_cmd), None)\
== 'pip install'