1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-30 22:54:14 +00:00

#334: Don't wait for all rules before showing result

This commit is contained in:
nvbn
2015-09-01 12:51:41 +03:00
parent ebe53f0d18
commit 12394ca842
7 changed files with 132 additions and 46 deletions

View File

@@ -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;']