mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-18 19:22:32 +01:00
Add useful constructors for Rule
and Command
for tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
from thefuck.types import Command
|
||||
from thefuck.rules.git_not_command import match, get_new_command
|
||||
from tests.utils import Command
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -31,14 +31,14 @@ def git_command():
|
||||
|
||||
|
||||
def test_match(git_not_command, git_command, git_not_command_one_of_this):
|
||||
assert match(Command('git brnch', '', git_not_command), None)
|
||||
assert match(Command('git st', '', git_not_command_one_of_this), None)
|
||||
assert not match(Command('ls brnch', '', git_not_command), None)
|
||||
assert not match(Command('git branch', '', git_command), None)
|
||||
assert match(Command('git brnch', stderr=git_not_command), None)
|
||||
assert match(Command('git st', stderr=git_not_command_one_of_this), None)
|
||||
assert not match(Command('ls brnch', stderr=git_not_command), None)
|
||||
assert not match(Command('git branch', stderr=git_command), None)
|
||||
|
||||
|
||||
def test_get_new_command(git_not_command, git_not_command_one_of_this):
|
||||
assert get_new_command(Command('git brnch', '', git_not_command), None)\
|
||||
assert get_new_command(Command('git brnch', stderr=git_not_command), None)\
|
||||
== 'git branch'
|
||||
assert get_new_command(
|
||||
Command('git st', '', git_not_command_one_of_this), None) == 'git status'
|
||||
assert get_new_command(Command('git st', stderr=git_not_command_one_of_this),
|
||||
None) == 'git status'
|
||||
|
Reference in New Issue
Block a user