1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-31 18:21:10 +00:00
thefuck/tests/rules/test_git_not_command.py

45 lines
1.1 KiB
Python
Raw Normal View History

2015-04-08 21:20:11 +02:00
import pytest
2015-04-22 23:04:22 +02:00
from thefuck.types import Command
2015-04-08 21:20:11 +02:00
from thefuck.rules.git_not_command import match, get_new_command
@pytest.fixture
def git_not_command():
return """git: 'brnch' is not a git command. See 'git --help'.
Did you mean this?
branch
"""
@pytest.fixture
def git_not_command_one_of_this():
return """git: 'st' is not a git command. See 'git --help'.
Did you mean one of these?
status
reset
stage
stash
stats
"""
2015-04-08 21:20:11 +02:00
@pytest.fixture
def git_command():
return "* master"
def test_match(git_not_command, git_command, git_not_command_one_of_this):
2015-04-08 21:20:11 +02:00
assert match(Command('git brnch', '', git_not_command), None)
assert match(Command('git st', '', git_not_command_one_of_this), None)
2015-04-08 21:20:11 +02:00
assert not match(Command('ls brnch', '', git_not_command), None)
assert not match(Command('git branch', '', git_command), None)
def test_get_new_command(git_not_command, git_not_command_one_of_this):
2015-04-08 21:20:11 +02:00
assert get_new_command(Command('git brnch', '', git_not_command), None)\
== 'git branch'
assert get_new_command(
Command('git st', '', git_not_command_one_of_this), None) == 'git status'