Skip to content

Commit d6f415b

Browse files
committed
Python: Run match tests if Python 3.10 or newer
Also fixes a bug in the tests
1 parent a4bb0cc commit d6f415b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

python/ql/test/experimental/dataflow/match/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def test_or_pattern():
4848
# No flow for literal pattern
4949
def test_literal_pattern():
5050
match SOURCE:
51-
case 42 as x:
52-
SINK(x) #$ flow="SOURCE, l:-2 -> x" flow="42, l:-1 -> x"
51+
case "source" as x:
52+
SINK(x) #$ flow="SOURCE, l:-2 -> x" flow="'source', l:-1 -> x"
5353

5454
def test_capture_pattern():
5555
match SOURCE:

python/ql/test/experimental/dataflow/validTest.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
def check_output(outtext, f):
24
if outtext == "OK\n":
35
pass
@@ -59,8 +61,11 @@ def check_tests_valid(testFile):
5961
check_tests_valid("module-initialization.multiphase")
6062
check_tests_valid("fieldflow.test")
6163

62-
# The below will fail unless we use Python 3.10 or newer.
63-
# check_tests_valid("match.test")
64+
if sys.version_info[:2] >= (3, 10):
65+
print("INFO: Will run `match` tests since we're running Python 3.10 or newer")
66+
check_tests_valid("match.test")
67+
else:
68+
print("WARN: Skipping `match` tests since we're not running 3.10 or newer")
6469

6570
# The below fails when trying to import modules
6671
# check_tests_valid("module-initialization.test")

0 commit comments

Comments
 (0)