gh-125811: Remove DeprecationWarnings in test_peg_generator (#125812)

This commit is contained in:
Mikhail Efimov 2024-10-22 11:41:30 +03:00 committed by GitHub
parent 03f9264ece
commit 4efe64aa56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -484,7 +484,7 @@ class TestPegen(unittest.TestCase):
def test_python_expr(self) -> None:
grammar = """
start: expr NEWLINE? $ { ast.Expression(expr, lineno=1, col_offset=0) }
start: expr NEWLINE? $ { ast.Expression(expr) }
expr: ( expr '+' term { ast.BinOp(expr, ast.Add(), term, lineno=expr.lineno, col_offset=expr.col_offset, end_lineno=term.end_lineno, end_col_offset=term.end_col_offset) }
| expr '-' term { ast.BinOp(expr, ast.Sub(), term, lineno=expr.lineno, col_offset=expr.col_offset, end_lineno=term.end_lineno, end_col_offset=term.end_col_offset) }
| term { term }
@ -893,7 +893,7 @@ class TestPegen(unittest.TestCase):
def test_locations_in_alt_action_and_group(self) -> None:
grammar = """
start: t=term NEWLINE? $ { ast.Expression(t, LOCATIONS) }
start: t=term NEWLINE? $ { ast.Expression(t) }
term:
| l=term '*' r=factor { ast.BinOp(l, ast.Mult(), r, LOCATIONS) }
| l=term '/' r=factor { ast.BinOp(l, ast.Div(), r, LOCATIONS) }