mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user