diff --git a/tests/rules/test_brew_link.py b/tests/rules/test_brew_link.py index 26f42aff..0586574c 100644 --- a/tests/rules/test_brew_link.py +++ b/tests/rules/test_brew_link.py @@ -8,13 +8,13 @@ def stderr(): return ("Error: Could not symlink bin/gcp\n" "Target /usr/local/bin/gcp\n" "already exists. You may want to remove it:\n" - "rm '/usr/local/bin/gcp'\n" + " rm '/usr/local/bin/gcp'\n" "\n" "To force the link and overwrite all conflicting files:\n" - "brew link --overwrite coreutils\n" + " brew link --overwrite coreutils\n" "\n" "To list all files that would be deleted:\n" - "brew link --overwrite --dry-run coreutils\n") + " brew link --overwrite --dry-run coreutils\n") @pytest.fixture diff --git a/tests/rules/test_composer_not_command.py b/tests/rules/test_composer_not_command.py index bb0a45dc..717ee3ab 100644 --- a/tests/rules/test_composer_not_command.py +++ b/tests/rules/test_composer_not_command.py @@ -51,6 +51,6 @@ def test_get_new_command(composer_not_command, composer_not_command_one_of_this) assert (get_new_command(Command('composer udpate', stderr=composer_not_command)) == 'composer update') - assert get_new_command( - Command('composer pdate', stderr=composer_not_command_one_of_this)) \ - == 'composer selfupdate' + assert (get_new_command(Command('composer pdate', + stderr=composer_not_command_one_of_this)) + == 'composer selfupdate') diff --git a/tests/rules/test_fix_alt_space.py b/tests/rules/test_fix_alt_space.py index c5b03c50..abc0ed1f 100644 --- a/tests/rules/test_fix_alt_space.py +++ b/tests/rules/test_fix_alt_space.py @@ -18,5 +18,5 @@ def test_match(): def test_get_new_command(): """ Replace the Alt+Space character by a simple space """ - assert get_new_command(Command(u'ps -ef | grep foo'))\ - == 'ps -ef | grep foo' + assert (get_new_command(Command(u'ps -ef | grep foo')) + == 'ps -ef | grep foo') diff --git a/tests/rules/test_git_not_command.py b/tests/rules/test_git_not_command.py index a65e3a3d..0c3c06f7 100644 --- a/tests/rules/test_git_not_command.py +++ b/tests/rules/test_git_not_command.py @@ -51,7 +51,7 @@ def test_get_new_command(git_not_command, git_not_command_one_of_this, git_not_command_closest): assert (get_new_command(Command('git brnch', stderr=git_not_command)) == ['git branch']) - assert get_new_command(Command('git st', stderr=git_not_command_one_of_this)) \ - == ['git stats', 'git stash', 'git stage'] - assert get_new_command(Command('git tags', stderr=git_not_command_closest)) \ - == ['git tag', 'git stage'] + assert (get_new_command(Command('git st', stderr=git_not_command_one_of_this)) + == ['git stats', 'git stash', 'git stage']) + assert (get_new_command(Command('git tags', stderr=git_not_command_closest)) + == ['git tag', 'git stage']) diff --git a/tests/test_corrector.py b/tests/test_corrector.py index 08e4160e..39b3c108 100644 --- a/tests/test_corrector.py +++ b/tests/test_corrector.py @@ -47,8 +47,8 @@ def test_get_corrected_commands(mocker): get_new_command=lambda x: [x.script + '@', x.script + ';'], priority=60)] mocker.patch('thefuck.corrector.get_rules', return_value=rules) - assert [cmd.script for cmd in get_corrected_commands(command)] \ - == ['test!', 'test@', 'test;'] + assert ([cmd.script for cmd in get_corrected_commands(command)] + == ['test!', 'test@', 'test;']) def test_organize_commands(): diff --git a/tests/test_types.py b/tests/test_types.py index d23ed85c..4faf8edf 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -41,8 +41,8 @@ class TestRule(object): priority=900, requires_output=True)) rule_path = os.path.join(os.sep, 'rules', 'bash.py') - assert Rule.from_path(Path(rule_path)) \ - == Rule('bash', match, get_new_command, priority=900) + assert (Rule.from_path(Path(rule_path)) + == Rule('bash', match, get_new_command, priority=900)) load_source.assert_called_once_with('bash', rule_path) @pytest.mark.parametrize('rules, exclude_rules, rule, is_enabled', [ @@ -79,15 +79,15 @@ class TestRule(object): def test_get_corrected_commands_with_rule_returns_list(self): rule = Rule(get_new_command=lambda x: [x.script + '!', x.script + '@'], priority=100) - assert list(rule.get_corrected_commands(Command(script='test'))) \ - == [CorrectedCommand(script='test!', priority=100), - CorrectedCommand(script='test@', priority=200)] + assert (list(rule.get_corrected_commands(Command(script='test'))) + == [CorrectedCommand(script='test!', priority=100), + CorrectedCommand(script='test@', priority=200)]) def test_get_corrected_commands_with_rule_returns_command(self): rule = Rule(get_new_command=lambda x: x.script + '!', priority=100) - assert list(rule.get_corrected_commands(Command(script='test'))) \ - == [CorrectedCommand(script='test!', priority=100)] + assert (list(rule.get_corrected_commands(Command(script='test'))) + == [CorrectedCommand(script='test!', priority=100)]) class TestCommand(object): diff --git a/tests/test_ui.py b/tests/test_ui.py index 90efbac2..1c2a9933 100644 --- a/tests/test_ui.py +++ b/tests/test_ui.py @@ -30,11 +30,11 @@ def test_read_actions(patch_get_key): const.KEY_DOWN, 'j', # Ctrl+C: const.KEY_CTRL_C, 'q']) - assert list(islice(ui.read_actions(), 8)) \ - == [const.ACTION_SELECT, const.ACTION_SELECT, - const.ACTION_PREVIOUS, const.ACTION_PREVIOUS, - const.ACTION_NEXT, const.ACTION_NEXT, - const.ACTION_ABORT, const.ACTION_ABORT] + assert (list(islice(ui.read_actions(), 8)) + == [const.ACTION_SELECT, const.ACTION_SELECT, + const.ACTION_PREVIOUS, const.ACTION_PREVIOUS, + const.ACTION_NEXT, const.ACTION_NEXT, + const.ACTION_ABORT, const.ACTION_ABORT]) def test_command_selector(): @@ -74,8 +74,8 @@ class TestSelectCommand(object): def test_without_confirmation_with_side_effects( self, capsys, commands_with_side_effect, settings): settings.require_confirmation = False - assert ui.select_command(iter(commands_with_side_effect)) \ - == commands_with_side_effect[0] + assert (ui.select_command(iter(commands_with_side_effect)) + == commands_with_side_effect[0]) assert capsys.readouterr() == ('', 'ls (+side effect)\n') def test_with_confirmation(self, capsys, patch_get_key, commands): @@ -91,8 +91,8 @@ class TestSelectCommand(object): def test_with_confirmation_with_side_effct(self, capsys, patch_get_key, commands_with_side_effect): patch_get_key(['\n']) - assert ui.select_command(iter(commands_with_side_effect)) \ - == commands_with_side_effect[0] + assert (ui.select_command(iter(commands_with_side_effect)) + == commands_with_side_effect[0]) assert capsys.readouterr() == ('', u'\x1b[1K\rls (+side effect) [enter/↑/↓/ctrl+c]\n') def test_with_confirmation_select_second(self, capsys, patch_get_key, commands): diff --git a/thefuck/rules/switch_lang.py b/thefuck/rules/switch_lang.py index b1abb63d..60e5780c 100644 --- a/thefuck/rules/switch_lang.py +++ b/thefuck/rules/switch_lang.py @@ -33,8 +33,8 @@ def match(command): if 'not found' not in command.stderr: return False matched_layout = _get_matched_layout(command) - return matched_layout and \ - _switch_command(command, matched_layout) != get_alias() + return (matched_layout and + _switch_command(command, matched_layout) != get_alias()) def get_new_command(command):