python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_syntax.cpython-311.opt-2.pyc

e	ddlZddlZddlZddlmZGddejZdZedkrej	dSdS)N)supportcNeZdZ		d'dZdZdZdZdZd	Zd
Z	dZ
dZd
ZdZ
dZdZdZdZdZdZdZdZdZdZdZejdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$ejd$Z%ejd%Z&ejd&Z'dS)(SyntaxTestCase
<testcase>execNc
		t||||ddS#t$r}
|r-t|
|s|d|jztj|t|
}||d|||
j	||||
j
||||
j||||
j||	!||
j
|	Yd}
~
dSYd}
~
dSd}
~
wwxYw)Nz#compile() did not raise SyntaxErrorzSyntaxError is not a %szSyntaxError did not contain )compilefailSyntaxError
isinstance__name__researchstrassertEqualfilenamelinenooffset
end_lineno
end_offset)selfcodeerrtextrmodesubclassrrrrerrmos            D/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_syntax.py_check_errorzSyntaxTestCase._check_error;s{		=D(D)))$
II;<<<<<#	=	=	=
I
3 9 9
I		3h6GGHHH7CHH--Bz			ggGHHHS\8444!  V444!  V444%  <<<%  <<<<<<<<<&%%%%%	=s+EC:D<<Ec6|ddddS)Nzprint(end1 + end2 = ' ')z=expression cannot contain assignment, perhaps you meant "=="?)rrrs rtest_expression_with_assignmentz.SyntaxTestCase.test_expression_with_assignmentYs2&K		
	
	
	
	
c6|ddddS)Nzf{}invalid syntaxsinglerr"r#s r1test_curly_brace_after_primary_raises_immediatelyz@SyntaxTestCase.test_curly_brace_after_primary_raises_immediately`s$%!1AAAAAr%c2|dddS)Nzf() = 1assignr"r#s rtest_assign_callzSyntaxTestCase.test_assign_callcs)X.....r%c|dd|dd|dd|dd|dd	|d
d|dd	|d
d	|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|d d|d!d|d"d#|d$ddS)%Nzdel (,)r'zdel 1zcannot delete literalz
del (1, 2)zdel Nonezcannot delete Nonezdel *xzcannot delete starredzdel (*x)zcannot use starred expressionz	del (*x,)z	del [*x,]zdel f()zcannot delete function callzdel f(a, b)z	del o.f()z
del a[0]()z
del x, f()z
del f(), xzdel [a, b, ((c), (d,), e.f())]zdel (a if True else b)zcannot delete conditionalzdel +azcannot delete expressionz	del a, +bz	del a + bzdel (a + b, c)zdel (c[0], a + b)z
del a.b.c + 2zdel a.b.c[0] + 2zdel (a, b, (c, d.e.f + 2))zdel [a, b, (c, d.e.f[0] + 2)]zdel (a := 5)zcannot delete named expressionz
del a += br"r#s rtest_assign_delzSyntaxTestCase.test_assign_delfs~)%5666'#:;;;,(?@@@*&:;;;($;<<<*&EFFF+'>???+'>???)%BCCC-)FGGG+'DEEE,(EFFF,(EFFF,(EFFF:<YZZZ24OPPP($>???+'ABBB+'ABBB*,FGGG-/IJJJ/+EFFF,.HIII68RSSS9;UVVV.*JKKK	
,(899999r%c:d}||dddS)Nzif 1:
            def error(a):
                global a  # SyntaxError
            def error2():
                b = 1
                global b  # SyntaxError
            zparameter and globalrr"rsources  rtest_global_param_err_firstz*SyntaxTestCase.test_global_param_err_firsts-	
&"8CCCCCr%c:d}||dddS)Nzif 1:
            def error(a):
                nonlocal a  # SyntaxError
            def error2():
                b = 1
                global b  # SyntaxError
            zparameter and nonlocalr1r2r"r3s  rtest_nonlocal_param_err_firstz,SyntaxTestCase.test_nonlocal_param_err_firsts-	
&":1EEEEEr%c|dd|dd|dd|dd|dd|dd|dd|d	d|d
ddS)Nzif 0: yieldoutside functionzif 0: yield
else:  x=1zif 1: pass
else: yieldzwhile 0: yieldzwhile 0: yield
else:  x=1zclass C:
  if 0: yieldz#class C:
  if 1: pass
  else: yieldzclass C:
  while 0: yieldz(class C:
  while 0: yield
  else:  x = 1r"r#s rtest_yield_outside_functionz*SyntaxTestCase.test_yield_outside_functions-8JKKK38JKKK38JKKK*8JKKK68JKKK38JKKKA,	.	.	.68JKKKF,	.	.	.	.	.r%c|dd|dd|dd|dd|dd|dd|dd|d	d|d
ddS)Nzif 0: returnr9zif 0: return
else:  x=1zif 1: pass
else: returnzwhile 0: returnzclass C:
  if 0: returnzclass C:
  while 0: returnz'class C:
  while 0: return
  else:  x=1z$class C:
  if 0: return
  else: x= 1z$class C:
  if 1: pass
  else: returnr"r#s rtest_return_outside_functionz+SyntaxTestCase.test_return_outside_functions.9KLLL49KLLL49KLLL+9KLLL49KLLL79KLLLE,	.	.	.B,	.	.	.B,	.	.	.	.	.r%cZd}|d|d|d|d|d|d|d|d|d	|d|d
|d|d|ddS)
Nzoutside loopbreakr2zif 0: breakzif 0: break
else:  x=1zif 1: pass
else: breakzclass C:
  if 0: breakz#class C:
  if 1: pass
  else: breakr1zwith object() as obj:
 breakr"rmsgs  rtest_break_outside_loopz&SyntaxTestCase.test_break_outside_loops'3q111-Q7773SCCC3SCCC3SCCCAa		)	)	)9a		)	)	)	)	)r%c*d}|d|d|d|d|d|d|d|d|d	|d
|d|ddS)Nznot properly in loopzif 0: continuer?r2zif 0: continue
else:  x=1zif 1: pass
else: continuer@zclass C:
  if 0: continuez&class C:
  if 1: pass
  else: continuer1z"with object() as obj:
    continuer"rAs  rtest_continue_outside_loopz)SyntaxTestCase.test_continue_outside_loops$*C:::6AFFF6AFFF6AFFFDa		)	)	)?a		)	)	)	)	)r%c@|ddtdS)Nz
foo()
 bar()
zunexpected indentrrIndentationErrorr#s rtest_unexpected_indentz%SyntaxTestCase.test_unexpected_indents2+-@#3		5	5	5	5	5r%c@|ddtdS)Nzif 1:
foo()zexpected an indented blockrGrHr#s rtest_no_indentzSyntaxTestCase.test_no_indents1.*F#3		5	5	5	5	5r%c@|ddtdS)Nzif 1:
  foo()
 bar()z unindent does not match .* levelrGrHr#s rtest_bad_outdentzSyntaxTestCase.test_bad_outdents22<#3		5	5	5	5	5r%c2|dddS)Nzint(base=10, '2')z,positional argument follows keyword argumentr"r#s rtest_kwargs_lastzSyntaxTestCase.test_kwargs_lasts/-H	J	J	J	J	Jr%c2|dddS)Nzint(**{'base': 10}, '2')z6positional argument follows keyword argument unpackingr"r#s rtest_kwargs_last2z SyntaxTestCase.test_kwargs_last2s,47	8	8	8	8	8r%c2|dddS)Nzint(**{'base': 10}, *['2'])z>iterable argument unpacking follows keyword argument unpackingr"r#s rtest_kwargs_last3z SyntaxTestCase.test_kwargs_last3s,77	8	8	8	8	8r%c<|dddddddS)Nz<foo(x,    y for y in range(3) for z in range(2) if z    , p)z*Generator expression must be parenthesizedr?5rrrrr"r#s rtest_generator_in_function_callz.SyntaxTestCase.test_generator_in_function_calls=XF!"q		L	L	L	L	Lr%c<|dddddddS)Nz9try: pass
except ValueError: pass
except* TypeError: pass:cannot have both 'except' and 'except\*' on the same 'try'r1r?rXr"r#s rtest_except_then_except_starz+SyntaxTestCase.test_except_then_except_star=WW!"qq		J	J	J	J	Jr%c<|dddddddS)Nz9try: pass
except* ValueError: pass
except TypeError: passr[r1r?r!rXr"r#s rtest_except_star_then_exceptz+SyntaxTestCase.test_except_star_then_exceptr^r%cd}	t|ddn%#t$r|dYnwxYwd}d}	t|ddt|dddS#t$r|dYdSwxYw)Nz\
pass
        \

pass
<string>rz8Empty line after a line continuation character is valid.zN\
def fib(n):
    \
'''Print a Fibonacci series up to n.'''
    \
a, b = 0, 1
zJ\
def fib(n):
    '''Print a Fibonacci series up to n.'''
    a, b = 0, 1
z/Indented statement over multiple lines is valid)r	rr
)rss1s2s    rtest_empty_line_after_linecontz-SyntaxTestCase.test_empty_line_after_lineconts
	RAz6****	R	R	RIIPQQQQQ	R
	IB
F+++B
F+++++	I	I	IIIGHHHHHH	Is88"A$$BBcLd}|tt|dS)Nz(\
if x:
    y = 1
  \
  foo = 1
        )assertRaisesrIrrrs  r!test_continuation_bad_indentationz0SyntaxTestCase.test_continuation_bad_indentations*	
*D$77777r%cd}tdD]&}|d|zdz
}|d|dzzdz
}|d|zdz
}'|dd	z
}||d
dS)Nz    ztry:
r?zraise Exception
zexcept Exception as e:
z0                                                pass!too many statically nested blocks)ranger)rris   rtest_nested_named_except_blocksz.SyntaxTestCase.test_nested_named_except_blocks!sr	:	:Avax''''Dvqs|6666Dvax9999DD8!!!!$ CDDDDDr%c6d}||ddS)Nzw
def func1():
    if a != b:
        raise ValueError

def func2():
    try
        return 1
    finally:
        pass
zexpected ':'r"ris  r&test_barry_as_flufl_with_syntax_errorsz5SyntaxTestCase.test_barry_as_flufl_with_syntax_errors+s'
	
$/////r%c|dddd|dddd|ddd	ddS)
Nz	a = 3 \ 46unexpected character after line continuation characterr?r\)rrz1,\#
2z
fgdfgf
1,\#
2
r1r"r#s r-test_invalid_line_continuation_error_positionz<SyntaxTestCase.test_invalid_line_continuation_error_position<s,R!"1		.	.	.	
*R!"1		.	.	.	
0R!"1		.	.	.	.	.r%c^|dd|dddS)NuA.Ɗ\ rvuA.μ\
zunexpected EOF while parsingr"r#s r-test_invalid_line_continuation_left_recursivez<SyntaxTestCase.test_invalid_line_continuation_left_recursiveGsK	
-R	T	T	T.8	:	:	:	:	:r%c4dD]}||dzd|d dD] }|d|dd|d!dD]}||dzd|d	 d
}||dd}||d
dS)Nz([{z1 + 2\z' was never closedza = z 1, 2, 3
b=3z)]}zunmatched '\'zFfunc(
    a=["unclosed], # Need a quote in this comment: "
    b=2,
)
z8parenthesis '\)' does not match opening parenthesis '\['s.# coding=latin
(aaaaaaaaaaaaaaaaa
aaaaaaaaaaaz'\(' was never closedr")rparenrrcs    rtest_error_parenthesisz%SyntaxTestCase.test_error_parenthesisOs	O	OEego/ME/M/M/MNNNN	[	[E9U999;Y;Y;Y;YZZZZ	I	IEego/Gu/G/G/GHHHH	
$ \]]]
C!455555r%c|dd|dd|dd|dddS)Nz'blechzunterminated string literalz"blechz'''blechz)unterminated triple-quoted string literalz"""blechr"r#s rtest_error_string_literalz(SyntaxTestCase.test_error_string_literalfsd($ABBB($ABBB*&QRRR*&QRRRRRr%c^|dd|dddS)Nzprint("Hello")zinvalid non-printable characterswith(0,,):
r"r#s rtest_invisible_charactersz(SyntaxTestCase.test_invisible_charactersms8.0QRRR-/PQQQQQr%c,d}t|dddS)Nz)
def match(x):
    return 1+1

match(34)
rbrr	ris  r+test_match_call_does_not_raise_syntax_errorz:SyntaxTestCase.test_match_call_does_not_raise_syntax_errorq#	j&)))))r%c,d}t|dddS)Nz'
def case(x):
    return 1+1

case(34)
rbrrris  r*test_case_call_does_not_raise_syntax_errorz9SyntaxTestCase.test_case_call_does_not_raise_syntax_errorzrr%c6|ddddS)Nzcall(
a=1,
a=1
)zkeyword argument repeatedr1r2r"r#s r/test_multiline_compiler_error_points_to_the_endz>SyntaxTestCase.test_multiline_compiler_error_points_to_the_ends2!'		
	
	
	
	
r%c6d}||ddS)Na
while 1:
 while 2:
  while 3:
   while 4:
    while 5:
     while 6:
      while 8:
       while 9:
        while 10:
         while 11:
          while 12:
           while 13:
            while 14:
             while 15:
              while 16:
               while 17:
                while 18:
                 while 19:
                  while 20:
                   while 21:
                    while 22:
                     break
ror"r3s  r)test_syntax_error_on_deeply_nested_blocksz8SyntaxTestCase.test_syntax_error_on_deeply_nested_blockss(0	
&"EFFFFFr%cddzdz}dD]s}||5|t5t|d|dddn#1swxYwYdddn#1swxYwYtdS)N-i4)revalr(r)rb)subTestrhMemoryErrorr	)rr4rs   r#test_error_on_parser_stack_overflowz2SyntaxTestCase.test_error_on_parser_stack_overflowsv#.	6	6D4((
6
6&&{3366FJ555666666666666666
6
6
6
6
6
6
6
6
6
6
6
6
6
6
6	6	6s4A3AA3A  A3#A $A33A7	:A7	cd}|t5t|ddddddS#1swxYwYdS)Nz,d{{{{{{{{{{{{{{{{{{{{{{{{{```{{{{{{{ef f():yrbr)rhrr	r3s  rtest_deep_invalid_rulez%SyntaxTestCase.test_deep_invalid_rules@


{
+
+	0	0FJ///	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0s<AA)rrNNNNN)(r

__module____qualname__rr$r*r-r/r5r7r:r<rCrErJrLrNrPrRrTrYr]r`rfrjrcpython_onlyrrrtrxrzrrrrrrrrrr%rrr9sCGKO====<


BBB///:::>DDDFFF......
)
)
)	)	)	)555555555
JJJ888
888
LLL
JJJ
JJJ
III@
8
8
8
EEE000"	.	.	.:::666.SSSRRR******



 G G GD
666
00000r%rcR|tj|S)N)addTestdoctestDocTestSuite)loadertestspatterns   r
load_testsrs"	MM'&(()))Lr%__main__)
rrunittesttestrTestCaserrr
mainrr%r<module>rspd9
			B0B0B0B0B0X&B0B0B0J
zHMOOOOOr%