mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-14 06:38:32 +00:00
Change files using black and flake8 style check
This commit is contained in:
parent
d7e2d4e3c6
commit
648d63869b
@ -3,30 +3,31 @@ from thefuck.rules.remove_shell_prompt_literal import match, get_new_command
|
||||
from thefuck.types import Command
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command',
|
||||
@pytest.mark.parametrize(
|
||||
"command",
|
||||
[
|
||||
Command('$ cd newdir', '$: command not found'),
|
||||
Command(' $ cd newdir', '$: command not found'),
|
||||
])
|
||||
Command("$ cd newdir", "$: command not found"),
|
||||
Command(" $ cd newdir", "$: command not found"),
|
||||
],
|
||||
)
|
||||
def test_match(command):
|
||||
assert match(command)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command',
|
||||
[
|
||||
Command('$', ''),
|
||||
Command('$?', ''),
|
||||
Command(' $?', ''),
|
||||
Command('', ''),
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"command",
|
||||
[Command("$", ""), Command("$?", ""), Command(" $?", ""), Command("", "")],
|
||||
)
|
||||
def test_not_match(command):
|
||||
assert not match(command)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('command, new_command',
|
||||
@pytest.mark.parametrize(
|
||||
"command, new_command",
|
||||
[
|
||||
(Command('$ cd newdir', ''), 'cd newdir'),
|
||||
(Command('$ python3 -m virtualenv env', ''), 'python3 -m virtualenv env'),
|
||||
])
|
||||
(Command("$ cd newdir", ""), "cd newdir"),
|
||||
(Command("$ python3 -m virtualenv env", ""), "python3 -m virtualenv env"),
|
||||
],
|
||||
)
|
||||
def test_get_new_command(command, new_command):
|
||||
assert get_new_command(command) == new_command
|
||||
|
@ -10,11 +10,16 @@ bash: $: command not found...
|
||||
|
||||
import re
|
||||
|
||||
|
||||
def match(command):
|
||||
return ("$: command not found" in command.output and
|
||||
re.search(r"^[\s]*\$ [\S]+", command.script) is not None)
|
||||
return (
|
||||
"$: command not found" in command.output
|
||||
and re.search(r"^[\s]*\$ [\S]+", command.script) is not None
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
return command.script.replace("$", "", 1).strip()
|
||||
|
||||
requires_output = True
|
||||
|
||||
requires_output = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user