Skip to content

Commit fa7295f

Browse files
authored
Merge pull request #20303 from hvitved/python/jump-to-def-unpack-tests
Python: Add jump-to-def tests for unpacking assignments
2 parents 4437f47 + bf47f66 commit fa7295f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

python/ql/test/query-tests/analysis/jump_to_defn/Definitions.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@
2626
| test.py:44:8:44:14 | ImportExpr | package/__init__.py:0:0:0:0 | Definition package/__init__.py:0 | Definition |
2727
| test.py:45:1:45:1 | p | test.py:44:8:44:14 | Definition test.py:44 | Definition |
2828
| test.py:45:3:45:3 | Attribute | package/__init__.py:2:18:2:18 | Definition package/__init__.py:2 | Definition |
29+
| test.py:48:32:48:38 | dirname | test.py:47:9:47:15 | Definition test.py:47 | Definition |
30+
| test.py:50:34:50:38 | lines | test.py:47:18:47:22 | Definition test.py:47 | Definition |
31+
| test.py:53:12:53:12 | x | test.py:49:9:49:12 | Definition test.py:49 | Definition |

python/ql/test/query-tests/analysis/jump_to_defn/test.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ class Decorated(object):
4343
from package import x
4444
import package as p
4545
p.x
46+
47+
def foo(dirname, lines):
48+
head, tail = os.path.split(dirname)
49+
x = head # `head` is missing jump-to-def target
50+
for start, line in enumerate(lines):
51+
line = line.strip() # `line` is missing jump-to-def target
52+
break
53+
return x

0 commit comments

Comments
 (0)