mirror of
https://github.com/django/django.git
synced 2025-08-02 01:53:15 +00:00
Fixed #23346 -- Fixed lazy() to lookup methods on the real object, not resultclasses.
Co-Authored-By: Rocky Meza <rmeza@fusionbox.com>
This commit is contained in:
parent
c5fb34c47e
commit
b4e76f30d1
2 changed files with 27 additions and 23 deletions
|
@ -22,6 +22,20 @@ class FunctionalTestCase(unittest.TestCase):
|
|||
t = lazy(lambda: Klazz(), Klazz)()
|
||||
self.assertIn('base_method', dir(t))
|
||||
|
||||
def test_lazy_base_class_override(self):
|
||||
"""Test that lazy finds the correct (overridden) method implementation"""
|
||||
|
||||
class Base(object):
|
||||
def method(self):
|
||||
return 'Base'
|
||||
|
||||
class Klazz(Base):
|
||||
def method(self):
|
||||
return 'Klazz'
|
||||
|
||||
t = lazy(lambda: Klazz(), Base)()
|
||||
self.assertEqual(t.method(), 'Klazz')
|
||||
|
||||
def test_lazy_property(self):
|
||||
|
||||
class A(object):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue