diff --git a/tests/rules/test_remove_shell_prompt_literal.py b/tests/rules/test_remove_shell_prompt_literal.py index f6fd7ba7..7c7149bf 100644 --- a/tests/rules/test_remove_shell_prompt_literal.py +++ b/tests/rules/test_remove_shell_prompt_literal.py @@ -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 diff --git a/thefuck/rules/remove_shell_prompt_literal.py b/thefuck/rules/remove_shell_prompt_literal.py index 6942b67c..4bdc558b 100644 --- a/thefuck/rules/remove_shell_prompt_literal.py +++ b/thefuck/rules/remove_shell_prompt_literal.py @@ -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 \ No newline at end of file + +requires_output = True