From b4e76f30d12bfa8a53cc297c60055c6f4629cc4c Mon Sep 17 00:00:00 2001 From: Gavin Wahl Date: Fri, 22 Aug 2014 10:31:26 -0600 Subject: Fixed #23346 -- Fixed lazy() to lookup methods on the real object, not resultclasses. Co-Authored-By: Rocky Meza --- tests/utils_tests/test_functional.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/utils_tests/test_functional.py') diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py index 7d71f32415..e8956a7a29 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -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): -- cgit v1.3