diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/python310.py | 18 | ||||
-rw-r--r-- | testsuite/support.py | 7 |
2 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/python310.py b/testsuite/python310.py index 83b7bb4..e78d372 100644 --- a/testsuite/python310.py +++ b/testsuite/python310.py @@ -7,3 +7,21 @@ match (var, var2): pass case _: print("Default") +#: E271:2:6 E271:3:9 E271:5:9 E271:7:9 +var = 1 +match var: + case 1: + pass + case 2: + pass + case ( + 3 + ): + pass +#: E275:2:6 E275:3:9 E275:5:9 +var = 1 +match(var): + case(1): + pass + case_: + pass diff --git a/testsuite/support.py b/testsuite/support.py index eb8b443..e6c897f 100644 --- a/testsuite/support.py +++ b/testsuite/support.py @@ -6,6 +6,7 @@ import sys from pycodestyle import Checker, BaseReport, StandardReport, readlines SELFTEST_REGEX = re.compile(r'\b(Okay|[EW]\d{3}):\s(.*)') +SELFTEST_PY_REGEX = re.compile(r'\bPython (\d).(\d+)') ROOT_DIR = os.path.dirname(os.path.dirname(__file__)) @@ -112,8 +113,14 @@ def selftest(options): counters = report.counters checks = options.physical_checks + options.logical_checks for name, check, argument_names in checks: + python_version = None for line in check.__doc__.splitlines(): line = line.lstrip() + match = SELFTEST_PY_REGEX.match(line) + if match: + python_version = tuple(map(int, match.groups())) + if python_version and sys.version_info < python_version: + continue match = SELFTEST_REGEX.match(line) if match is None: continue |