#N/A Add ability to disable memoization in tests

This commit is contained in:
nvbn
2015-07-10 17:06:05 +03:00
parent 4b4e7acc0f
commit f40b63f44b
3 changed files with 17 additions and 2 deletions
+2 -1
View File
@@ -80,12 +80,13 @@ def memoize(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
key = pickle.dumps((args, kwargs))
if key not in memo:
if key not in memo or memoize.disabled:
memo[key] = fn(*args, **kwargs)
return memo[key]
return wrapper
memoize.disabled = False
def get_closest(word, possibilities, n=3, cutoff=0.6):