diff --git a/tests/rules/test_brew_upgrade.py b/tests/rules/test_brew_upgrade.py index efe0d4ce..941bb2c3 100644 --- a/tests/rules/test_brew_upgrade.py +++ b/tests/rules/test_brew_upgrade.py @@ -4,12 +4,12 @@ from tests.utils import Command @pytest.mark.parametrize('command', [ - Command(script='brew upgrade')]) + Command(script='brew upgrade')]) def test_match(command): - assert match(command, None) + assert match(command, None) @pytest.mark.parametrize('command, new_command', [ - (Command('brew upgrade'), 'brew upgrade --all')]) + (Command('brew upgrade'), 'brew upgrade --all')]) def test_get_new_command(command, new_command): - assert get_new_command(command, None) == new_command + assert get_new_command(command, None) == new_command diff --git a/tests/rules/test_go_run.py b/tests/rules/test_go_run.py index 05745054..0ab140b4 100644 --- a/tests/rules/test_go_run.py +++ b/tests/rules/test_go_run.py @@ -4,14 +4,14 @@ from tests.utils import Command @pytest.mark.parametrize('command', [ - Command(script='go run foo'), - Command(script='go run bar')]) + Command(script='go run foo'), + Command(script='go run bar')]) def test_match(command): - assert match(command, None) + assert match(command, None) @pytest.mark.parametrize('command, new_command', [ - (Command('go run foo'), 'go run foo.go'), - (Command('go run bar'), 'go run bar.go')]) + (Command('go run foo'), 'go run foo.go'), + (Command('go run bar'), 'go run bar.go')]) def test_get_new_command(command, new_command): - assert get_new_command(command, None) == new_command + assert get_new_command(command, None) == new_command diff --git a/tests/rules/test_java.py b/tests/rules/test_java.py index d51c8806..928ac69d 100644 --- a/tests/rules/test_java.py +++ b/tests/rules/test_java.py @@ -4,14 +4,14 @@ from tests.utils import Command @pytest.mark.parametrize('command', [ - Command(script='java foo.java'), - Command(script='java bar.java')]) + Command(script='java foo.java'), + Command(script='java bar.java')]) def test_match(command): - assert match(command, None) + assert match(command, None) @pytest.mark.parametrize('command, new_command', [ - (Command('java foo.java'), 'java foo'), - (Command('java bar.java'), 'java bar')]) + (Command('java foo.java'), 'java foo'), + (Command('java bar.java'), 'java bar')]) def test_get_new_command(command, new_command): - assert get_new_command(command, None) == new_command + assert get_new_command(command, None) == new_command diff --git a/tests/rules/test_javac.py b/tests/rules/test_javac.py index 6bac2d78..47000384 100644 --- a/tests/rules/test_javac.py +++ b/tests/rules/test_javac.py @@ -4,14 +4,14 @@ from tests.utils import Command @pytest.mark.parametrize('command', [ - Command(script='javac foo'), - Command(script='javac bar')]) + Command(script='javac foo'), + Command(script='javac bar')]) def test_match(command): - assert match(command, None) + assert match(command, None) @pytest.mark.parametrize('command, new_command', [ - (Command('javac foo'), 'javac foo.java'), - (Command('javac bar'), 'javac bar.java')]) + (Command('javac foo'), 'javac foo.java'), + (Command('javac bar'), 'javac bar.java')]) def test_get_new_command(command, new_command): - assert get_new_command(command, None) == new_command + assert get_new_command(command, None) == new_command diff --git a/tests/rules/test_open.py b/tests/rules/test_open.py index ea350b55..892f9b57 100644 --- a/tests/rules/test_open.py +++ b/tests/rules/test_open.py @@ -4,22 +4,22 @@ from tests.utils import Command @pytest.mark.parametrize('command', [ - Command(script='open foo.com'), - Command(script='open foo.ly'), - Command(script='open foo.org'), - Command(script='open foo.net'), - Command(script='open foo.se'), - Command(script='open foo.io')]) + Command(script='open foo.com'), + Command(script='open foo.ly'), + Command(script='open foo.org'), + Command(script='open foo.net'), + Command(script='open foo.se'), + Command(script='open foo.io')]) def test_match(command): - assert match(command, None) + assert match(command, None) @pytest.mark.parametrize('command, new_command', [ - (Command('open foo.com'), 'open http://foo.com'), - (Command('open foo.ly'), 'open http://foo.ly'), - (Command('open foo.org'), 'open http://foo.org'), - (Command('open foo.net'), 'open http://foo.net'), - (Command('open foo.se'), 'open http://foo.se'), - (Command('open foo.io'), 'open http://foo.io')]) + (Command('open foo.com'), 'open http://foo.com'), + (Command('open foo.ly'), 'open http://foo.ly'), + (Command('open foo.org'), 'open http://foo.org'), + (Command('open foo.net'), 'open http://foo.net'), + (Command('open foo.se'), 'open http://foo.se'), + (Command('open foo.io'), 'open http://foo.io')]) def test_get_new_command(command, new_command): - assert get_new_command(command, None) == new_command + assert get_new_command(command, None) == new_command diff --git a/tests/rules/test_python_compile.py b/tests/rules/test_python_compile.py index d7bf9889..c3986503 100644 --- a/tests/rules/test_python_compile.py +++ b/tests/rules/test_python_compile.py @@ -4,14 +4,14 @@ from tests.utils import Command @pytest.mark.parametrize('command', [ - Command(script='python foo'), - Command(script='python bar')]) + Command(script='python foo'), + Command(script='python bar')]) def test_match(command): - assert match(command, None) + assert match(command, None) @pytest.mark.parametrize('command, new_command', [ - (Command('python foo'), 'python foo.py'), - (Command('python bar'), 'python bar.py')]) + (Command('python foo'), 'python foo.py'), + (Command('python bar'), 'python bar.py')]) def test_get_new_command(command, new_command): - assert get_new_command(command, None) == new_command + assert get_new_command(command, None) == new_command diff --git a/tests/rules/test_quotation_marks.py b/tests/rules/test_quotation_marks.py index 2963ac77..7c654e77 100644 --- a/tests/rules/test_quotation_marks.py +++ b/tests/rules/test_quotation_marks.py @@ -4,16 +4,16 @@ from tests.utils import Command @pytest.mark.parametrize('command', [ - Command(script="git commit -m \'My Message\""), + Command(script="git commit -m \'My Message\""), Command(script="git commit -am \"Mismatched Quotation Marks\'"), Command(script="echo \"hello\'")]) def test_match(command): - assert match(command, None) + assert match(command, None) @pytest.mark.parametrize('command, new_command', [ - (Command("git commit -m \'My Message\""), "git commit -m \"My Message\""), + (Command("git commit -m \'My Message\""), "git commit -m \"My Message\""), (Command("git commit -am \"Mismatched Quotation Marks\'"), "git commit -am \"Mismatched Quotation Marks\""), (Command("echo \"hello\'"), "echo \"hello\"")]) def test_get_new_command(command, new_command): - assert get_new_command(command, None) == new_command + assert get_new_command(command, None) == new_command diff --git a/thefuck/rules/java.py b/thefuck/rules/java.py index 31474e80..d2852328 100644 --- a/thefuck/rules/java.py +++ b/thefuck/rules/java.py @@ -1,13 +1,14 @@ # Fixes common java command mistake -# +# # Example: # > java foo.java # Error: Could not find or load main class foo.java -# + def match(command, settings): - return (command.script.startswith ('java ') - and command.script.endswith ('.java')) + return (command.script.startswith('java ') + and command.script.endswith('.java')) + def get_new_command(command, settings): - return command.script[:-5] + return command.script[:-5] diff --git a/thefuck/rules/javac.py b/thefuck/rules/javac.py index 7ee4389f..af19cc71 100644 --- a/thefuck/rules/javac.py +++ b/thefuck/rules/javac.py @@ -1,15 +1,15 @@ # Appends .java when compiling java files -# +# # Example: # > javac foo -# error: Class names, 'foo', are only accepted if annotation +# error: Class names, 'foo', are only accepted if annotation # processing is explicitly requested -# -# + def match(command, settings): - return (command.script.startswith ('javac ') - and not command.script.endswith('.java')) + return (command.script.startswith('javac ') + and not command.script.endswith('.java')) + def get_new_command(command, settings): - return command.script + '.java' + return command.script + '.java' diff --git a/thefuck/rules/python_compile.py b/thefuck/rules/python_compile.py index 39adcafa..1b15aab6 100644 --- a/thefuck/rules/python_compile.py +++ b/thefuck/rules/python_compile.py @@ -1,15 +1,14 @@ # Appends .py when compiling python files -# +# # Example: # > python foo # error: python: can't open file 'foo': [Errno 2] No such file or directory -# -# def match(command, settings): - return (command.script.startswith ('python ') - and not command.script.endswith('.py')) + return (command.script.startswith('python ') + and not command.script.endswith('.py')) + def get_new_command(command, settings): - return command.script + '.py' + return command.script + '.py'