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:
		| @@ -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']) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user