File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -235,7 +235,8 @@ def baz():
235235 """ , 9 , 20 )
236236 check ("pass\n pass\n pass\n (1+)\n pass\n pass\n pass" , 4 , 4 )
237237 check ("(1+)" , 1 , 4 )
238- check (b"\xef \xbb \xbf #coding: utf8\n print('\xe6 \x88 \x91 ')\n " , 0 , - 1 )
238+ check (b"\xef \xbb \xbf #coding: utf8\n print('\xe6 \x88 \x91 ')\n " , 0 ,
239+ 0 if support .use_old_parser () else - 1 )
239240
240241 # Errors thrown by symtable.c
241242 check ('x = [(yield i) for i in range(3)]' , 1 , 5 )
Original file line number Diff line number Diff line change @@ -211,6 +211,7 @@ def test_ast_line_numbers_nested(self):
211211 self .assertEqual (call .lineno , 3 )
212212 self .assertEqual (call .col_offset , 11 )
213213
214+ @unittest .skipIf (use_old_parser (), "The old parser gets the offsets incorrectly for fstrings" )
214215 def test_ast_line_numbers_duplicate_expression (self ):
215216 expr = """
216217a = 10
@@ -277,6 +278,7 @@ def test_ast_line_numbers_duplicate_expression(self):
277278 self .assertEqual (binop .left .col_offset , 23 )
278279 self .assertEqual (binop .right .col_offset , 27 )
279280
281+ @unittest .skipIf (use_old_parser (), "The old parser gets the offsets incorrectly for fstrings" )
280282 def test_ast_numbers_fstring_with_formatting (self ):
281283
282284 t = ast .parse ('f"Here is that pesky {xxx:.3f} again"' )
Original file line number Diff line number Diff line change 429429>>> f((x)=2)
430430Traceback (most recent call last):
431431SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
432- >>> f(True=2)
433- Traceback (most recent call last):
434- SyntaxError: expression cannot contain assignment, perhaps you meant "=="?
435432>>> f(__debug__=1)
436433Traceback (most recent call last):
437434SyntaxError: cannot assign to __debug__
@@ -978,10 +975,11 @@ def func2():
978975"""
979976 self ._check_error (code , "invalid syntax" )
980977
978+ @unittest .skipIf (support .use_old_parser (), "The old parser " )
981979 def test_invalid_line_continuation_error_position (self ):
982980 self ._check_error (r"a = 3 \ 4" ,
983981 "unexpected character after line continuation character" ,
984- lineno = 1 , offset = 9 )
982+ lineno = 1 , offset = ( 10 if support . use_old_parser () else 9 ) )
985983
986984 def test_invalid_line_continuation_left_recursive (self ):
987985 # Check bpo-42218: SyntaxErrors following left-recursive rules
You can’t perform that action at this time.
0 commit comments