diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2011-04-11 09:04:27 +0200 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2011-04-11 09:04:27 +0200 |
commit | 9044fabeabf34e261ede5c0b918b39a8f65cbb2f (patch) | |
tree | a11d6b130608844dbc33264704a1942dd33146a6 /test | |
parent | 16b24ec7837e73dce47b6b4e201b81d6a510ade7 (diff) | |
download | logilab-common-9044fabeabf34e261ede5c0b918b39a8f65cbb2f.tar.gz |
test and fix clear_cache to work on cached **properties**. remove debug print
Diffstat (limited to 'test')
-rw-r--r-- | test/unittest_decorators.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unittest_decorators.py b/test/unittest_decorators.py index b3321fc..1f92d55 100644 --- a/test/unittest_decorators.py +++ b/test/unittest_decorators.py @@ -102,5 +102,18 @@ class DecoratorsTC(TestCase): clear_cache(foo, 'foo') self.assertFalse(hasattr(foo, '_foo')) + def test_cached_property(self): + class Foo(object): + @property + @cached(cacheattr=u'_foo') + def foo(self): + """ what's up doc ? """ + foo = Foo() + foo.foo + self.assertEqual(foo._foo, None) + clear_cache(foo, 'foo') + self.assertFalse(hasattr(foo, '_foo')) + + if __name__ == '__main__': unittest_main() |