mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 04:21:14 +00:00
7f0f9a966f
Before: 4 E101 indentation contains mixed spaces and tabs 20 E122 continuation line missing indentation or outdented 1 E124 closing bracket does not match visual indentation 12 E127 continuation line over-indented for visual indent 22 E128 continuation line under-indented for visual indent 2 E211 whitespace before '(' 12 E302 expected 2 blank lines, found 1 1 E303 too many blank lines (3) 4 E402 module level import not at top of file 123 E501 line too long (81 > 79 characters) 2 E731 do not assign a lambda expression, use a def 3 W191 indentation contains tabs 20 W291 trailing whitespace 3 W293 blank line contains whitespace 2 W391 blank line at end of file 69 W503 line break before binary operator After: 20 E122 continuation line missing indentation or outdented 12 E127 continuation line over-indented for visual indent 22 E128 continuation line under-indented for visual indent 123 E501 line too long (81 > 79 characters) 2 E731 do not assign a lambda expression, use a def 1 W291 trailing whitespace 68 W503 line break before binary operator
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
import pytest
|
|
from thefuck.rules.git_fix_stash import match, get_new_command
|
|
from tests.utils import Command
|
|
|
|
|
|
git_stash_err = '''
|
|
usage: git stash list [<options>]
|
|
or: git stash show [<stash>]
|
|
or: git stash drop [-q|--quiet] [<stash>]
|
|
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
|
|
or: git stash branch <branchname> [<stash>]
|
|
or: git stash [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
|
|
\t\t [-u|--include-untracked] [-a|--all] [<message>]]
|
|
or: git stash clear
|
|
'''
|
|
|
|
|
|
@pytest.mark.parametrize('wrong', [
|
|
'git stash opp',
|
|
'git stash Some message',
|
|
'git stash saev Some message'])
|
|
def test_match(wrong):
|
|
assert match(Command(wrong, stderr=git_stash_err), None)
|
|
|
|
|
|
@pytest.mark.parametrize('wrong,fixed', [
|
|
('git stash opp', 'git stash pop'),
|
|
('git stash Some message', 'git stash save Some message'),
|
|
('git stash saev Some message', 'git stash save Some message')])
|
|
def test_get_new_command(wrong, fixed):
|
|
assert get_new_command(Command(wrong, stderr=git_stash_err), None) == fixed
|