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

#N/A Add get_closest utility function

This commit is contained in:
nvbn
2015-07-08 21:30:24 +03:00
parent fbf7b91005
commit c0eae8b85c
5 changed files with 33 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
import pytest
from mock import Mock
from thefuck.utils import sudo_support, wrap_settings, memoize
from thefuck.utils import sudo_support, wrap_settings, memoize, get_closest
from thefuck.types import Settings
from tests.utils import Command
@@ -32,3 +32,12 @@ def test_memoize():
memoized()
memoized()
fn.assert_called_once_with()
class TestGetClosest(object):
def test_when_can_match(self):
assert 'branch' == get_closest('brnch', ['branch', 'status'])
def test_when_cant_match(self):
assert 'status' == get_closest('st', ['status', 'reset'])