From 51e4e8728098903a87fb6d1cd2083460d439f357 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Mon, 16 Aug 2021 22:44:13 +0200 Subject: [PATCH] #1227: Make `git_support` support output-independent rules Fix #1227 --- tests/specific/test_git.py | 5 +++-- thefuck/specific/git.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/specific/test_git.py b/tests/specific/test_git.py index a171210..10acb6c 100644 --- a/tests/specific/test_git.py +++ b/tests/specific/test_git.py @@ -27,9 +27,10 @@ def test_git_support(called, command, output): ('ls', False), ('cat git', False), ('cat hub', False)]) -def test_git_support_match(command, is_git): +@pytest.mark.parametrize('output', ['', None]) +def test_git_support_match(command, is_git, output): @git_support def fn(command): return True - assert fn(Command(command, '')) == is_git + assert fn(Command(command, output)) == is_git diff --git a/thefuck/specific/git.py b/thefuck/specific/git.py index c8f11bd..9793146 100644 --- a/thefuck/specific/git.py +++ b/thefuck/specific/git.py @@ -14,7 +14,7 @@ def git_support(fn, command): return False # perform git aliases expansion - if 'trace: alias expansion:' in command.output: + if command.output and 'trace: alias expansion:' in command.output: search = re.search("trace: alias expansion: ([^ ]*) => ([^\n]*)", command.output) alias = search.group(1)