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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user