From 71461b14ab0c5a3801d85738fde3aedd407d7115 Mon Sep 17 00:00:00 2001 From: Curtis Date: Sat, 24 May 2014 20:29:31 +1000 Subject: Fixed #22691 -- Added aliasing to cached_property. --- tests/utils_tests/test_functional.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/utils_tests/test_functional.py') diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py index b6145ff0d0..e9010b3135 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -52,6 +52,11 @@ class FunctionalTestCase(unittest.TestCase): def value(self): return 1, object() + def other_value(self): + return 1 + + other = cached_property(other_value, name='other') + a = A() # check that it is cached @@ -67,6 +72,10 @@ class FunctionalTestCase(unittest.TestCase): # check that it behaves like a property when there's no instance self.assertIsInstance(A.value, cached_property) + # check that overriding name works + self.assertEqual(a.other, 1) + self.assertTrue(callable(a.other_value)) + def test_lazy_equality(self): """ Tests that == and != work correctly for Promises. -- cgit v1.3