1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #22691 -- Added aliasing to cached_property.

This commit is contained in:
Curtis
2014-05-24 20:29:31 +10:00
committed by Tim Graham
parent 34ba86706f
commit 71461b14ab
3 changed files with 34 additions and 3 deletions

View File

@@ -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.