From fdf26a652d1f32aea0e8743dca033e9046c20cc5 Mon Sep 17 00:00:00 2001 From: Philip Arola Date: Wed, 30 Oct 2019 11:47:59 -0700 Subject: [PATCH] Fixed flake errors --- tests/rules/test_choco_install.py | 2 +- thefuck/rules/choco_install.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/rules/test_choco_install.py b/tests/rules/test_choco_install.py index bf5d2d41..5bcf4079 100644 --- a/tests/rules/test_choco_install.py +++ b/tests/rules/test_choco_install.py @@ -13,6 +13,6 @@ from thefuck.types import Command ('choco install logstitcher -y -n=test /env', 'choco install logstitcher.install -y -n=test /env'), ('cinst logstitcher -y -n=test /env', 'cinst logstitcher.install -y -n=test /env'), ('choco install chocolatey -y', 'choco install chocolatey.install -y'), - ('cinst chocolatey -y', 'cinst chocolatey.install -y'),]) + ('cinst chocolatey -y', 'cinst chocolatey.install -y'), ]) def test_get_new_command(before, after): assert (get_new_command(Command(before, '')) == after) diff --git a/thefuck/rules/choco_install.py b/thefuck/rules/choco_install.py index f9206117..8c073022 100644 --- a/thefuck/rules/choco_install.py +++ b/thefuck/rules/choco_install.py @@ -1,5 +1,6 @@ from thefuck.utils import for_app, which + @for_app("choco", "cinst") def match(command): return ((command.script.startswith('choco install') or 'cinst' in command.script_parts) @@ -11,11 +12,11 @@ def get_new_command(command): for script_part in command.script_parts: if ( script_part not in ["choco", "cinst", "install"] - # Need exact match (bc chocolatey is a package) + # Need exact match (bc chocolatey is a package) and not script_part.startswith('-') - # Leading hyphens are parameters; some packages contain them though + # Leading hyphens are parameters; some packages contain them though and '=' not in script_part and '/' not in script_part - # These are certainly parameters + # These are certainly parameters ): return command.script.replace(script_part, script_part + ".install") return []