Skip to content

Commit aaddd36

Browse files
committed
Python: Add another type-tracking attr test
This one just works out of the box 💪
1 parent 89cba21 commit aaddd36

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python/ql/test/experimental/dataflow/typetracking/attribute_tests.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ def test_set_x():
3939
set_foo(x) # $ MISSING: tracked=foo
4040
print(x.foo) # $ MISSING: tracked=foo tracked
4141

42+
# return from a different function
43+
def create_with_foo():
44+
x = SomeClass() # $ tracked=foo
45+
x.foo = tracked # $ tracked=foo tracked
46+
return x # $ tracked=foo
47+
48+
def test_create_with_foo():
49+
x = create_with_foo() # $ tracked=foo
50+
print(x.foo) # $ tracked=foo tracked
51+
4252
# ------------------------------------------------------------------------------
4353
# Attributes assigned statically to a class
4454
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)