1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-07-10 00:53:26 +01:00

Use memoize decorator for caching

This commit is contained in:
nvbn
2015-05-22 17:07:01 +03:00
parent 84a28d8c73
commit 190e47ecdb
3 changed files with 54 additions and 38 deletions

@ -1,6 +1,6 @@
import pytest
from mock import Mock
from thefuck.utils import sudo_support, wrap_settings
from thefuck.utils import sudo_support, wrap_settings, memoize
from thefuck.types import Settings
from tests.utils import Command
@ -24,3 +24,11 @@ def test_sudo_support(return_value, command, called, result):
fn = Mock(return_value=return_value, __name__='')
assert sudo_support(fn)(Command(command), None) == result
fn.assert_called_once_with(Command(called), None)
def test_memoize():
fn = Mock(__name__='fn')
memoized = memoize(fn)
memoized()
memoized()
fn.assert_called_once_with()