diff options
author | Tres Seaver <tseaver@palladion.com> | 2014-02-02 11:17:07 -0500 |
---|---|---|
committer | Tres Seaver <tseaver@palladion.com> | 2014-02-02 11:17:07 -0500 |
commit | 40ad9a2418f0ebd212fe03d27f18862116d26183 (patch) | |
tree | 78151f84f2f90ab890a93c7f6d185db790f6b3f5 | |
parent | 16dd05288e6ddc063a9a15c4693f0ef714a90064 (diff) | |
parent | ec90e3d8d7f12599d69eeeaf925c648651d2c753 (diff) | |
download | repoze-lru-40ad9a2418f0ebd212fe03d27f18862116d26183.tar.gz |
Merge PR #20.
-rw-r--r-- | repoze/lru/__init__.py | 1 | ||||
-rw-r--r-- | repoze/lru/tests.py | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/repoze/lru/__init__.py b/repoze/lru/__init__.py index 83f22b3..e5c3280 100644 --- a/repoze/lru/__init__.py +++ b/repoze/lru/__init__.py @@ -294,6 +294,7 @@ class lru_cache(object): _maybe_copy(f, lru_cached, '__module__') _maybe_copy(f, lru_cached, '__name__') _maybe_copy(f, lru_cached, '__doc__') + lru_cached._cache = cache return lru_cached diff --git a/repoze/lru/tests.py b/repoze/lru/tests.py index 69a1c35..7922a30 100644 --- a/repoze/lru/tests.py +++ b/repoze/lru/tests.py @@ -520,6 +520,14 @@ class DecoratorTests(unittest.TestCase): self.assertEqual(result, 2) self.assertEqual(len(cache), 2) + def test_cache_attr(self): + cache = DummyLRUCache() + decorator = self._makeOne(0, cache) + def wrapped(key): + return key + decorated = decorator(wrapped) + self.assertEqual(decorated._cache, cache) + def test_multiargs(self): cache = DummyLRUCache() decorator = self._makeOne(0, cache) |