More 2-x grammar test fixes

This commit is contained in:
rocky
2024-02-04 15:05:47 -05:00
parent ad16ed69eb
commit d01a047dfd
2 changed files with 14 additions and 4 deletions

View File

@@ -1,7 +1,9 @@
import re
from xdis.version_info import IS_PYPY, PYTHON_VERSION_TRIPLE
from uncompyle6.parser import get_python_parser, python_parser
from uncompyle6.scanner import get_scanner
from xdis.version_info import PYTHON_VERSION_TRIPLE, IS_PYPY
def test_grammar():
@@ -28,7 +30,7 @@ def test_grammar():
expect_lhs.add("get_iter")
if PYTHON_VERSION_TRIPLE >= (3, 8) or PYTHON_VERSION_TRIPLE < (3, 0):
if PYTHON_VERSION_TRIPLE >= (3, 8):
expect_lhs.add("stmts_opt")
else:
expect_lhs.add("async_with_as_stmt")
@@ -46,7 +48,10 @@ def test_grammar():
expect_lhs.add("kv3")
unused_rhs.add("dict")
else:
if PYTHON_VERSION_TRIPLE < (3, 7) and PYTHON_VERSION_TRIPLE[:2] not in ((2, 7), (2, 6)):
if PYTHON_VERSION_TRIPLE < (3, 7) and PYTHON_VERSION_TRIPLE[:2] not in (
(2, 7),
(2, 6),
):
# NOTE: this may disappear
expect_lhs.add("except_handler_else")
@@ -101,7 +106,9 @@ def test_grammar():
)
reduced_dup_rhs = dict((k, dup_rhs[k]) for k in dup_rhs if k not in expect_dup_rhs)
if reduced_dup_rhs:
print("\nPossible duplicate RHS that might be folded, into one of the LHS symbols")
print(
"\nPossible duplicate RHS that might be folded, into one of the LHS symbols"
)
for k in reduced_dup_rhs:
print(k, reduced_dup_rhs[k])
# assert not reduced_dup_rhs, reduced_dup_rhs

View File

@@ -29,6 +29,9 @@ class TestGrammar(unittest.TestCase):
)
expect_lhs.add("kwarg")
if PYTHON_VERSION_TRIPLE[:2] <= (3, 6):
unused_rhs.add("call")
if PYTHON_VERSION_TRIPLE[:2] == (2, 7):
expect_lhs.add("kv3")
expect_lhs.add("kvlist")