Skip to content

Python: Add jump-to-def tests for unpacking assignments#20303

Merged
hvitved merged 1 commit intogithub:mainfrom
hvitved:python/jump-to-def-unpack-tests
Aug 28, 2025
Merged

Python: Add jump-to-def tests for unpacking assignments#20303
hvitved merged 1 commit intogithub:mainfrom
hvitved:python/jump-to-def-unpack-tests

Conversation

@hvitved
Copy link
Copy Markdown
Contributor

@hvitved hvitved commented Aug 28, 2025

Document missing jump-to-def targets.

@hvitved hvitved added the no-change-note-required This PR does not need a change note label Aug 28, 2025
@hvitved hvitved marked this pull request as ready for review August 28, 2025 08:39
@hvitved hvitved requested a review from a team as a code owner August 28, 2025 08:39
Copilot AI review requested due to automatic review settings August 28, 2025 08:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds test cases for jump-to-definition functionality in Python unpacking assignments to document currently missing jump-to-def targets. The changes identify specific scenarios where variable references should have jump-to-definition support but currently don't.

  • Adds test cases with unpacking assignments (head, tail = os.path.split(dirname)) and loop unpacking (for start, line in enumerate(lines))
  • Documents missing jump-to-def targets with inline comments
  • Updates expected test results to reflect current behavior for existing working jump-to-def cases

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
python/ql/test/query-tests/analysis/jump_to_defn/test.py Adds new test function with unpacking assignments and comments documenting missing jump-to-def targets
python/ql/test/query-tests/analysis/jump_to_defn/Definitions.expected Updates expected test results with working jump-to-def cases for function parameters and variable assignments

Copy link
Copy Markdown
Contributor

@tausbn tausbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like something that ought to use inline test expectations (but I'm not going to insist on it). 🙂

@hvitved hvitved merged commit fa7295f into github:main Aug 28, 2025
11 checks passed
@hvitved hvitved deleted the python/jump-to-def-unpack-tests branch August 28, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants