#334: Don't wait for all rules before showing result
This commit is contained in:
+2
-11
@@ -3,7 +3,7 @@ from pathlib import PosixPath, Path
|
||||
from mock import Mock
|
||||
from thefuck import corrector, conf, types
|
||||
from tests.utils import Rule, Command, CorrectedCommand
|
||||
from thefuck.corrector import make_corrected_commands, get_corrected_commands, remove_duplicates
|
||||
from thefuck.corrector import make_corrected_commands, get_corrected_commands
|
||||
|
||||
|
||||
def test_load_rule(mocker):
|
||||
@@ -75,15 +75,6 @@ class TestGetCorrectedCommands(object):
|
||||
== [CorrectedCommand(script='test!', priority=100)]
|
||||
|
||||
|
||||
def test_remove_duplicates():
|
||||
side_effect = lambda *_: None
|
||||
assert set(remove_duplicates([CorrectedCommand('ls', priority=100),
|
||||
CorrectedCommand('ls', priority=200),
|
||||
CorrectedCommand('ls', side_effect, 300)])) \
|
||||
== {CorrectedCommand('ls', priority=100),
|
||||
CorrectedCommand('ls', side_effect, 300)}
|
||||
|
||||
|
||||
def test_get_corrected_commands(mocker):
|
||||
command = Command('test', 'test', 'test')
|
||||
rules = [Rule(match=lambda *_: False),
|
||||
@@ -94,4 +85,4 @@ def test_get_corrected_commands(mocker):
|
||||
priority=60)]
|
||||
mocker.patch('thefuck.corrector.get_rules', return_value=rules)
|
||||
assert [cmd.script for cmd in get_corrected_commands(command, None, Mock(debug=False))] \
|
||||
== ['test@', 'test!', 'test;']
|
||||
== ['test!', 'test@', 'test;']
|
||||
|
||||
Reference in New Issue
Block a user