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:
Gavin Wahl 2014-08-22 10:31:26 -06:00 committed by Tim Graham
parent c5fb34c47e
commit b4e76f30d1
2 changed files with 27 additions and 23 deletions

View file

@ -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):