summaryrefslogtreecommitdiff
path: root/tests/unittest_regrtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittest_regrtest.py')
-rw-r--r--tests/unittest_regrtest.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/unittest_regrtest.py b/tests/unittest_regrtest.py
index 7171941b..17668edd 100644
--- a/tests/unittest_regrtest.py
+++ b/tests/unittest_regrtest.py
@@ -324,5 +324,24 @@ class Whatever:
a = property(lambda x: x, lambda x: x)
+def test_ancestor_looking_up_redefined_function():
+ code = """
+ class Foo:
+ def _format(self):
+ pass
+
+ def format(self):
+ self.format = self._format
+ self.format()
+ Foo
+ """
+ node = extract_node(code)
+ inferred = next(node.infer())
+ ancestor = next(inferred.ancestors())
+ _, found = ancestor.lookup("format")
+ assert len(found) == 1
+ assert isinstance(found[0], nodes.FunctionDef)
+
+
if __name__ == "__main__":
unittest.main()