Python: Add copy of extractor tests

These get to live next to the existing library and query tests, and are
run as part of both the Python 2 and Python 3 language tests.
This commit is contained in:
Taus
2024-04-15 12:22:07 +00:00
parent d5073df24c
commit e45f6e9b24
182 changed files with 13695 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
import unittest
#This should cause a syntax error at the end of line 8
class TestBase(unittest.TestCase):

View File

@@ -0,0 +1,2 @@
#Illegal use of rhs expression of lhs
[x for a in b] = y

View File

@@ -0,0 +1,3 @@
#This parses, but is illegal.
"hello" = "world"

View File

@@ -0,0 +1,8 @@
a if cond else b = 1

View File

@@ -0,0 +1,4 @@
def foo(seq):
for var in seq:
body
illegal-dedent

View File

@@ -0,0 +1,4 @@
def foo(seq):
for var in seq:
body
illegal-dedent

View File

@@ -0,0 +1 @@
semmle-extractor-options: --max-import-depth=0

View File

@@ -0,0 +1,3 @@
| illegal_context2.py | Syntax Error | 3 | 1 |
| illegal_context.py | Syntax Error | 2 | 1 |
| illegal_if.py | Syntax Error | 7 | 1 |

View File

@@ -0,0 +1,5 @@
import python
from SyntaxError s, string fp, int line, int col
where s.hasLocationInfo(fp, line, col, _, _)
select fp, s.toString(), line, col