From: George Sakkis Date: Tue, 21 Apr 2015 10:09:05 +0000 (+0300) Subject: Fixes for Python 2.6 and Python 3 X-Git-Tag: 1.2.0~5^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cfa04cdd2a392b7b23a66c73f7326629d369c5f4;p=cached-property.git Fixes for Python 2.6 and Python 3 --- diff --git a/cached_property.py b/cached_property.py index ee896ae..4b77bbf 100644 --- a/cached_property.py +++ b/cached_property.py @@ -85,7 +85,7 @@ class cached_property_with_ttl(object): except KeyError: pass else: - ttl_expired = 0 < self.ttl < now - last_updated + ttl_expired = self.ttl and self.ttl < now - last_updated if not ttl_expired: return value diff --git a/tests/test_cached_property.py b/tests/test_cached_property.py index 1bca7ab..1e0e68a 100644 --- a/tests/test_cached_property.py +++ b/tests/test_cached_property.py @@ -87,7 +87,8 @@ class TestCachedProperty(unittest.TestCase): # Typically descriptors return themselves if accessed though the class # rather than through an instance. - self.assertIsInstance(Check.add_cached, self.cached_property_factory) + self.assertTrue(isinstance(Check.add_cached, + self.cached_property_factory)) def test_reset_cached_property(self): Check = CheckFactory(self.cached_property_factory)