From cba93ded77af314bdf109f9f7c0d421ee5236122 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Thu, 20 Oct 2022 21:11:01 +0200 Subject: [PATCH] Python: Add test for `@property` problem --- .../CallGraph/InlineCallGraphTest.expected | 6 +++--- .../library-tests/CallGraph/code/class_properties.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected b/python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected index 2e2c1cd655f..ddeba0cf074 100644 --- a/python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected +++ b/python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.expected @@ -1,8 +1,8 @@ failures debug_callableNotUnique -| code/class_properties.py:7:5:7:18 | Function arg | Qualified function name 'Prop.arg' is not unique within its file. Please fix. | -| code/class_properties.py:12:5:12:25 | Function arg | Qualified function name 'Prop.arg' is not unique within its file. Please fix. | -| code/class_properties.py:17:5:17:18 | Function arg | Qualified function name 'Prop.arg' is not unique within its file. Please fix. | +| code/class_properties.py:10:5:10:18 | Function arg | Qualified function name 'Prop.arg' is not unique within its file. Please fix. | +| code/class_properties.py:15:5:15:25 | Function arg | Qualified function name 'Prop.arg' is not unique within its file. Please fix. | +| code/class_properties.py:20:5:20:18 | Function arg | Qualified function name 'Prop.arg' is not unique within its file. Please fix. | pointsTo_found_typeTracker_notFound | code/class_attr_assign.py:10:9:10:27 | ControlFlowNode for Attribute() | my_func | | code/class_attr_assign.py:11:9:11:25 | ControlFlowNode for Attribute() | my_func | diff --git a/python/ql/test/experimental/library-tests/CallGraph/code/class_properties.py b/python/ql/test/experimental/library-tests/CallGraph/code/class_properties.py index 06e4f3f3bd2..de436339115 100644 --- a/python/ql/test/experimental/library-tests/CallGraph/code/class_properties.py +++ b/python/ql/test/experimental/library-tests/CallGraph/code/class_properties.py @@ -1,3 +1,6 @@ +def func(): + print("func") + class Prop(object): def __init__(self, arg): self._arg = arg @@ -32,6 +35,11 @@ class Prop(object): arg2 = property(_arg2_getter, _arg2_setter, _arg2_deleter) + @property + def func_prop(self): + print("Prop.func_prop getter") + return func + prop = Prop(42) # $ tt=Prop.__init__ prop.arg @@ -41,3 +49,6 @@ del prop.arg prop.arg2 prop.arg2 = 43 del prop.arg2 + +f = prop.func_prop +f() # $ SPURIOUS: tt=Prop.func_prop MISSING: tt=func