1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-11-01 23:51:59 +00:00

Compare commits

..

2 Commits
2.9 ... 2.9.1

Author SHA1 Message Date
nvbn
6df772ba05 Bump to 2.9.1 2015-09-05 11:46:34 +03:00
nvbn
e2e8b6fc86 Fix without result 2015-09-05 11:45:39 +03:00
3 changed files with 9 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ elif (3, 0) < version < (3, 3):
' ({}.{} detected).'.format(*version))
sys.exit(-1)
VERSION = '2.9'
VERSION = '2.9.1'
install_requires = ['psutil', 'colorama', 'six', 'decorator']
extras_require = {':python_version<"3.4"': ['pathlib']}

View File

@@ -44,6 +44,10 @@ class TestSortedCorrectedCommandsSequence(object):
assert set(seq) == {CorrectedCommand('ls', priority=100),
CorrectedCommand('ls', side_effect, 300)}
def test_with_blank(self, settings):
seq = SortedCorrectedCommandsSequence(iter([]), settings)
assert list(seq) == []
class TestCorrectedCommand(object):

View File

@@ -81,9 +81,10 @@ class SortedCorrectedCommandsSequence(object):
def _realise(self):
"""Realises generator, removes duplicates and sorts commands."""
commands = self._remove_duplicates(self._commands)
self._cached = [self._cached[0]] + sorted(
commands, key=lambda corrected_command: corrected_command.priority)
if self._cached:
commands = self._remove_duplicates(self._commands)
self._cached = [self._cached[0]] + sorted(
commands, key=lambda corrected_command: corrected_command.priority)
self._realised = True
debug('SortedCommandsSequence was realised with: {}, after: {}'.format(
self._cached, '\n'.join(format_stack())), self._settings)