mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-19 03:32:31 +01:00
Add useful constructors for Rule
and Command
for tests
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import pytest
|
||||
from thefuck.types import Command
|
||||
from thefuck.rules.brew_unknown_command import match, get_new_command
|
||||
from thefuck.rules.brew_unknown_command import brew_commands
|
||||
from tests.utils import Command
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -15,14 +15,14 @@ def brew_unknown_cmd_instaa():
|
||||
|
||||
|
||||
def test_match(brew_unknown_cmd):
|
||||
assert match(Command('brew inst', '', brew_unknown_cmd), None)
|
||||
assert match(Command('brew inst', stderr=brew_unknown_cmd), None)
|
||||
for command in brew_commands:
|
||||
assert not match(Command('brew ' + command, '', ''), None)
|
||||
assert not match(Command('brew ' + command), None)
|
||||
|
||||
|
||||
def test_get_new_command(brew_unknown_cmd, brew_unknown_cmd_instaa):
|
||||
assert get_new_command(Command('brew inst', '', brew_unknown_cmd), None)\
|
||||
assert get_new_command(Command('brew inst', stderr=brew_unknown_cmd), None)\
|
||||
== 'brew list'
|
||||
|
||||
assert get_new_command(Command('brew instaa', '', brew_unknown_cmd_instaa),
|
||||
assert get_new_command(Command('brew instaa', stderr=brew_unknown_cmd_instaa),
|
||||
None) == 'brew install'
|
||||
|
Reference in New Issue
Block a user