mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: Run match tests if Python 3.10 or newer
Also fixes a bug in the tests
This commit is contained in:
@@ -48,8 +48,8 @@ def test_or_pattern():
|
||||
# No flow for literal pattern
|
||||
def test_literal_pattern():
|
||||
match SOURCE:
|
||||
case 42 as x:
|
||||
SINK(x) #$ flow="SOURCE, l:-2 -> x" flow="42, l:-1 -> x"
|
||||
case "source" as x:
|
||||
SINK(x) #$ flow="SOURCE, l:-2 -> x" flow="'source', l:-1 -> x"
|
||||
|
||||
def test_capture_pattern():
|
||||
match SOURCE:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import sys
|
||||
|
||||
def check_output(outtext, f):
|
||||
if outtext == "OK\n":
|
||||
pass
|
||||
@@ -59,8 +61,11 @@ if __name__ == "__main__":
|
||||
check_tests_valid("module-initialization.multiphase")
|
||||
check_tests_valid("fieldflow.test")
|
||||
|
||||
# The below will fail unless we use Python 3.10 or newer.
|
||||
# check_tests_valid("match.test")
|
||||
if sys.version_info[:2] >= (3, 10):
|
||||
print("INFO: Will run `match` tests since we're running Python 3.10 or newer")
|
||||
check_tests_valid("match.test")
|
||||
else:
|
||||
print("WARN: Skipping `match` tests since we're not running 3.10 or newer")
|
||||
|
||||
# The below fails when trying to import modules
|
||||
# check_tests_valid("module-initialization.test")
|
||||
|
||||
Reference in New Issue
Block a user