Taus
131ec8d22f
Python: Handle loop constructs outside of loops
...
Observed on some test files in Nuitka/Nuitka, having `break` and
`continue` outside of loops in Python is (to Python) a syntax error, but
our parser happily accepted this broken syntax.
This then caused issues further downstream in the control-flow
construction, as it broke some invariants.
To fix this we now skip the code that would previously fail when the
invariants are broken.
Co-authored-by: yoff <yoff@github.com >
2025-02-06 14:30:16 +00:00
Joe Farebrother
e8adef18a3
Update to inline expectations + fixes
2025-02-04 14:45:59 +00:00
Joe Farebrother
aa2c84ea36
Move tests to separate folder
2025-02-04 14:45:56 +00:00
Joe Farebrother
d248fbfe57
Merge pull request #18301 from joefarebrother/python-model-missing-builtins
...
Python: Add models for builtins `map`, `filter`, `zip`, and `enumerate`.
2025-01-20 16:39:37 +00:00
Paolo Tranquilli
4ab5650979
Python: add some more FP tests around match
2025-01-17 11:01:00 +01:00
Joe Farebrother
2aea356756
Add change note + fix tests
2025-01-15 10:24:18 +00:00
Joe Farebrother
6a6585e415
Add tests for zip and enumerate
2025-01-15 09:57:15 +00:00
Joe Farebrother
460de3f7d5
Reduce generality of map and zip for performance
2025-01-14 09:39:57 +00:00
Joe Farebrother
4e36008ed9
Add tests
2025-01-14 09:39:56 +00:00
Joe Farebrother
a7fb73a2b2
Merge pull request #18185 from joefarebrother/python-lxml
...
Python: Model additional flow steps for the lxml framework
2025-01-10 13:40:16 +00:00
Joe Farebrother
35961e454b
Fix tests to check for the correct type
2025-01-07 15:23:07 +00:00
Rasmus Wriedt Larsen
34631a8784
Python: Model FastAPI requests
...
Co-authored-by: Joe Farebrother <joefarebrother@github.com >
2024-12-18 15:58:51 +01:00
Rasmus Wriedt Larsen
79dfbf7b21
Python: Add FastAPI request test
...
Co-authored-by: Joe Farebrother <joefarebrother@github.com >
2024-12-18 15:48:29 +01:00
Joe Farebrother
dcbcf7e2bd
Add additional tests demonstrating false negative flow
2024-12-12 15:55:36 +00:00
Michael Nebel
2321ca59f6
Python: Update all test util paths to point to the new location.
2024-12-12 13:54:30 +01:00
Michael Nebel
1490400ab0
Python: Move test utilities into the query pack.
2024-12-12 13:54:28 +01:00
Joe Farebrother
2019ddfa7f
Qldoc improvements + add a few extra tests
2024-12-11 12:25:40 +00:00
Joe Farebrother
bcb08bbc7b
Update test output
2024-12-10 19:24:05 +00:00
Joe Farebrother
29a90235e8
Improve tests and use API graphs
2024-12-10 19:09:45 +00:00
Joe Farebrother
d2ed92d6d0
Added tests
2024-12-10 19:09:20 +00:00
Joe Farebrother
f82fa20249
Update test outputs
2024-12-09 20:37:11 +00:00
Joe Farebrother
462be46be9
Update test output
2024-12-09 19:57:52 +00:00
Joe Farebrother
ebaab89933
Formatting updates
2024-12-09 19:57:25 +00:00
Joe Farebrother
dd8b7a4a8f
Add additional test for safe case in documentation
2024-12-09 19:57:19 +00:00
Joe Farebrother
0f0c1e1609
Test update
2024-12-09 19:56:46 +00:00
Joe Farebrother
4602c5c905
Remove experimental version + qhelp fixes
2024-12-09 19:56:18 +00:00
Joe Farebrother
cea196ec61
Add concepts tests + some fixes
2024-12-09 19:55:42 +00:00
Joe Farebrother
1cb01a286d
Add tests for jinja
2024-12-09 19:55:36 +00:00
yoff
81c8a702ff
Merge pull request #18112 from github/tausbn/add-api-graph-support-for-parameter-annotations
2024-12-05 15:05:27 +01:00
Jeroen Ketema
10592bb1c4
Merge pull request #18192 from jketema/inline-rm
...
Remove deprecated `InlineExpectationsTest` class-based API
2024-12-04 11:34:39 +01:00
Anders Schack-Mulligen
8a5fc97b06
Python: Remove deprecated configuration classes referencing deleted api.
2024-12-03 20:08:45 +01:00
Jeroen Ketema
c3ea883b11
Python: Update expected test results
2024-12-03 19:18:57 +01:00
Taus
2734377e5d
Python: Add API graph support for parameter annotations
...
Adds API graph support for observing that in
```python
def foo(x : Bar): ...
```
The variable `x` is likely to be an instance of the type `Bar` inside
this function.
In particular, we add `getInstanceFromAnnotation` as a predicate on API
graph nodes that tracks this step (corresponding to a new edge type
labeled with "annotation" in the API graph), and extend the existing
`getAnInstance` predicate to also include instances arising from type
annotations.
A more complete solution would also add support for annotated
assignments (`x : Foo = ...` or just `x : Foo`) as well as track types
through type aliases (`type Foo = Bar`). This turns out to be
non-trivial, however, as these type constructs don't have any CFG nodes
(and so no data-flow nodes by default either). In order to not have
perfect be the enemy of good, this commit is only targeting the type
parameter case (which is also likely to be the most common use case
anyway).
The tests for API graphs have been extended accordingly, including tests
for the kinds of type ascriptions that we _don't_ currently model in API
graphs (marked with `MISSING:` in the inline tests).
2024-11-26 13:03:06 +00:00
yoff
44c94e02fe
Merge pull request #18037 from joefarebrother/pythob-test-global-capture
...
Python: Add some test cases for flow involving global and captured variables
2024-11-22 11:33:31 +01:00
Joe Farebrother
52cd7f2c5c
Add 2 more cases
2024-11-20 11:22:42 +00:00
Joe Farebrother
9b4b01a442
Fix typo
2024-11-20 10:59:27 +00:00
Joe Farebrother
a398f707fe
Add some test cases for flow involving global variables and captured variables
2024-11-19 16:34:59 +00:00
yoff
d4ec8f650a
Merge pull request #18030 from github/tausbn/python-fix-match-literal-pruning
...
Python: Fix pruning of literals in `match` pattern
2024-11-19 17:16:22 +01:00
yoff
22287be5d1
Merge pull request #17370 from Kwstubbs/Bottle/Tornado-HeaderSupport
...
Python: Bottle Framework Support
2024-11-19 15:34:26 +01:00
Taus
e2530cf14f
Python: Update expected test output
...
Co-authored-by: yoff <lerchedahl@gmail.com >
2024-11-19 14:10:50 +00:00
Paolo Tranquilli
147d66b587
Merge branch 'main' into redsun82/python-match-fps
2024-11-07 09:46:32 +01:00
yoff
cec0544ca5
Merge pull request #17789 from aschackmull/python/resolvecall-refactor
...
Python: Refactor references to NormalCall.
2024-11-01 14:20:34 +01:00
Kevin Stubbings
ac411f1254
Second round feedback
2024-10-30 13:52:38 -07:00
Anders Schack-Mulligen
8b5756526c
Update python/ql/test/experimental/library-tests/CallGraph/InlineCallGraphTest.ql
...
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com >
2024-10-29 13:57:27 +01:00
Tom Hvitved
e5f2bbb6ec
Python: Post-processing query for inline test expectations
2024-10-29 13:35:37 +01:00
Tom Hvitved
7c4d5981dd
Shared: Add missing spaces in inline test expectation output
2024-10-25 13:23:03 +02:00
Arthur Baars
08af7d0007
Merge pull request #17810 from github/post-release-prep/codeql-cli-2.19.2
...
Post-release preparation for codeql-cli-2.19.2
2024-10-18 18:28:07 +02:00
Rasmus Lerchedahl Petersen
30e5a12230
Python: udate expectations
2024-10-18 15:14:51 +02:00
Anders Schack-Mulligen
5950c336e2
Python: Refactor references to NormalCall.
2024-10-16 16:04:31 +02:00
Taus
65dbc1de91
Python: Add copy.replace test to list of runnable tests
2024-10-15 18:17:00 +02:00