
    /hh\                       S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKJr  S SK	J
r
  S SKJr  S SKJrJrJrJrJrJrJrJr  S SKJr  S SKJrJr  S SKJr  S S	KJr   S SKrS S
KJ r    " S S\"5      r# " S S\"5      r$ " S S\"5      r% " S S\RL                  5      r' " S S\RL                  5      r( " S S\RL                  5      r) " S S\RL                  5      r*S r+ " S S\RL                  5      r,\RZ                   " S S\RL                  5      5       r. " S S \RL                  5      r/ " S! S"\RL                  5      r0\1S#:X  a  \Rd                  " 5         gg! \! a    SrSr  GNf = f)$    N)BOM_UTF8)product)dedent)captured_stderrcheck_impl_detailcpython_only
gc_collect
no_tracingscript_helperSuppressCrashReportforce_not_colorized)import_module)TESTFNunlink)check_warnings)support)INT_MAXic                       \ rS rSrS rSrg)NaiveException    c                     Xl         g Nxselfr   s     =/opt/python-3.13.8/usr/lib/python3.13/test/test_exceptions.py__init__NaiveException.__init__!           r   N__name__
__module____qualname____firstlineno__r   __static_attributes__ r!   r   r   r       s    r!   r   c                       \ rS rSrSrS rSrg)SlottedNaiveException$   r   c                     Xl         g r   r   r   s     r   r   SlottedNaiveException.__init__&   r    r!   N)r#   r$   r%   r&   	__slots__r   r'   r(   r!   r   r*   r*   $   s    Ir!   r*   c                       \ rS rSrS rSrg)BrokenStrException)   c                     [        S5      e)Nzstr() is broken	Exceptionr   s    r   __str__BrokenStrException.__str__*   s    )**r!   r(   N)r#   r$   r%   r&   r6   r'   r(   r!   r   r0   r0   )   s    +r!   r0   c                      \ rS rSrS rS rS rS rSWS jrS r	S	 r
\R                  " \\R                  :  S
5      \R"                  " S5      \R$                  " \SSS9S 5       5       5       r\S 5       rS r\R.                  " \R0                  S:H  S5      S 5       rS rS rS rS rS rS rS r S r!S r"S r#S r$S  r%\&S! 5       r'S" r(S# r)S$ r*S% r+S& r,S' r-S( r.S) r/S* r0S+ r1S, r2S- r3S. r4S/ r5S0 r6S1 r7S2 r8S3 r9S4 r:S5 r;S6 r<S7 r=S8 r>S9 r?S: r@S; rAS< rBS= rC\&S> 5       rD\\R"                  " S5      S? 5       5       rE\S@ 5       rF\\R                  " \GSL SA5      \HSB 5       5       5       rISC rJ\\R                  " \R                  SD5      \R                  " \GSL SA5      SE 5       5       5       rL\\R                  " \GSL SA5      SF 5       5       rM\\R                  " \GSL SA5      SG 5       5       rN\\R                  " \GSL SA5      SH 5       5       rO\&SI 5       rPSJ rQSK rRSL rS\\R                  " \R                  SD5      \R                  " \GSL SA5      SM 5       5       5       rTSN rUSO rVSP rW\R.                  " SSQ5      SR 5       rXSS rY\R                  " \GSL SA5      ST 5       rZ\\R                  " \R                  SD5      SU 5       5       r[SVr\g)XExceptionTests0   c                 L   U R                  XS9    U" S5      e! U a  n[        U5      n S nAOS nAff = f U" S5      e! U a  n[        U5      n S nAOS nAff = fU R                  XE5        U R                  UR                  U5        S S S 5        g ! , (       d  f       g = f)N)excexcnamespam)subTeststrassertEqualr#   )r   r<   r=   errbuf1buf2s         r   raise_catchExceptionTests.raise_catch2   s    \\c\3 &k!  3x  &k!  3x T(S\\73 433sH   B50B5BAAABA0B
B#c                    U R                  [        S5        U R                  [        [        [        S5        U R                  [
        S5        [        [        SSS9nUR                  5         [        [        SSS9n[        R                  n  SS K
nUR                  S	5        U[        l	        UR                  5         [        [        5        U R                  [        S
5        U R                  [        [        SS5        U R                  [        S5        U R                  [        [        S5        U R                  [         S5        / nU R                  [         UR"                  S5        U R                  [$        S5        0 nU R                  [$        UR"                  S5        U R                  [&        S5        U R                  [(        S5        U R                  [*        S5        [,        nU R                  [.        S5        Sn[1        S5       H  nXD-  nM	     U R                  [2        S5        U R                  [4        S5        U R                  [6        S5        [9        S5        U R                  [:        S5        U R                  [<        S5        [?        SSS 5        U RA                  S!5        U R                  [B        S"5        U R                  [D        S#5        U R                  [D        [        RF                  S5        U R                  [H        S$5        / S%-     U R                  [J        S&5        U R                  [J        [L        S'5        U R                  [N        S(5        SS-  nU R                  [P        S)5        SS-  nU R                  [R        S*5        g ! [
         a     GNf = f! U[        l	        UR                  5         [        [        5        f = f! [*         a     GNf = f! [6         a     GNf = f! [<         a     GNYf = f! [H         a     Nf = f! [N         a     Nf = f! [P         a
  n S nANS nAff = f)+NAttributeErrorundefined_attributeEOFErrorwutf-8encodingrr   r!   OSErrorzthis file does not existImportErrorundefined_module
IndexError
   KeyErrorkeyKeyboardInterruptMemoryError	NameErrorOverflowError      RuntimeErrorRecursionErrorSyntaxErrorz/
IndentationErrorTabErrorz"try:
	1/0
    	1/0
finally:
 pass
<string>execzTabError not raisedSystemError
SystemExit	TypeErrorr(   
ValueErrori   ZeroDivisionErrorr4   StopAsyncIteration)*rE   rH   assertRaisesgetattrsysrJ   openr   closestdinmarshalloadsr   rP   rQ   
__import__rS   __getitem__rU   rW   rX   rY   undefined_variablerZ   ranger]   r^   r_   rc   r`   ra   compilefailrd   re   exitrf   rg   chrrh   r4   ri   )r   fp	savestdinrp   r   dummyes          r   testRaisingExceptionTests.testRaising?   sU   )9:.'38MN:.&#0

&#0II			c" "CIHHJ6N),'4)CSIm4+z3EF\2*ammR8:.(AMM59*,?@m4K0#Q 	83ZEFA   	~6)9:m4%[ 	)+=>:.@) ii-.m4\2*chh2K0"W 	\2*c62*,?@1Q 	K01Q 	+-ABK   "CIHHJ6N, $  D   $ !&$& #t#s   N #O O) O: P !P <P+ 
N&"N) %N&&N) ),O
O&%O&)
O76O7:
PP
PP
P('P(+
P?:P?c                 L   ^  U 4S jnSnU" US5        U" SS5        U" SS5        g )Nc                 *  > TR                  XS9    [        U SS5        TR                  S5        S S S 5        g ! [         a=  nUR                  U:w  a#  TR                  SU< SUR                  < 35         S nANKS nAff = f! , (       d  f       g = f)N)srcmsg
<fragment>rc   "failed to get expected SyntaxError	expected , got )r?   rv   rw   r_   r   )r   r   r}   r   s      r   ckmsg4ExceptionTests.testSyntaxErrorMessage.<locals>.ckmsg   sx    #/DCv6
 IIBC 0/ # Huu|		3"FGH 0/s1   B:B
B3A<7B<BB
BzHif 1:
        try:
            continue
        except:
            passz'continue' not properly in loopz	continue
zf'{6 0}'z+invalid syntax. Perhaps you forgot a comma?r(   r   r   ss   `  r   testSyntaxErrorMessage%ExceptionTests.testSyntaxErrorMessage   s3    	D 	a23l=>jGHr!   c                    ^  [         4U 4S jjnSnU" US5        SnU" US5        SnU" US5        SnU" US5        SnU" US5        S	nU" US
5        SnU" US
5        SnU" US[        5        SnU" US[        5        g )Nc                    >  [        U SS5        TR                  S5        g ! U aB  nUR                  U:w  a(  TR                  SU< SUR                  < 35         S nAg  S nAg S nAff = f)Nr   rc   r   r   r   )rv   rw   r   )r   r   	exceptionr}   r   s       r   r   :ExceptionTests.testSyntaxErrorMissingParens.<locals>.ckmsg   s`    @\62
 		>?	  D55C<IIsAEEBCC  Ds   " A*3A%%A*zprint "old style"z@Missing parentheses in call to 'print'. Did you mean print(...)?zprint "old style",zprint f(a+b,c)zexec "old style"z>Missing parentheses in call to 'exec'. Did you mean exec(...)?zexec f(a+b,c)zprint (a+b,c) $ 42zinvalid syntaxzexec (a+b,c) $ 42zif True:
print "No indent"z9expected an indented block after 'if' statement on line 1z6if True:
        print()
	exec "mixed tabs and spaces"z2inconsistent use of tabs and spaces in indentation)r_   r`   ra   r   s   `  r   testSyntaxErrorMissingParens+ExceptionTests.testSyntaxErrorMissingParens   s    &1 	@ $aST$aSTaST"aQRaQR
 !a!"a!" .aLN^_KaExPr!   Nc                    U R                  XUS9   U R                  [        5       n[        USS5        S S S 5        U R	                  WR
                  R                  U5        U R	                  UR
                  R                  U5        Ub&  U R	                  UR
                  R                  U5        Ub&  U R	                  UR
                  R                  U5        UR
                  R                  bc  [        U[        5      (       d  UR                  US5      nUR                  S5      US-
     nU R                  XR
                  R                  5        S S S 5        g ! , (       d  f       GN0= f! , (       d  f       g = f)N)sourcelinenooffsetr   rc   replace
r[   )r?   rj   r_   rv   rA   r   r   r   
end_lineno
end_offsettext
isinstancer@   decodesplitassertIn)	r   r   r   r   r   r   rN   cmlines	            r   checkExceptionTests.check   s   \\F\C"";/2\62 0R\\00&9R\\00&9%  !8!8*E%  !8!8*E||  ,!#s++**Xy9Cyyvax0dLL$5$56 DC// DCs"   E0ED E0
E-	(E00
E>c                 0    U R                   nU" SSS5        g )Nz"\
"(1 for c in I,\
\   )r   r   r   s     r   )test_error_offset_continuation_characters8ExceptionTests.test_error_offset_continuation_characters   s    

*Aq1r!   c                 4   U R                   nU" SSS5        U" SSS5        U" SSS5        U" S	SS
5        U" SSS
5        U" SSSSS9  U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" SSS5        U" S SSSS!5        U" S"SSSS
5        U" S#SS$SS%5        U" S&SS$SS%5        U" S'SS5        U" S(SS5        U" S)SS5        U" S*SS5        U" S+SS,5        U" S-SS,5        U" S.SS5        U" S/SS$5        U" S0SS5        U" S1SS,5        U" S2SS5        U" S3SS$5        U" S4SS$5        U" S5SS$S6S9  U" S7SS85        U" S9SS5        U" S:SS5        U" S;SS5        U" S<S=S>5        U" S?SS@5        U" SASS@5        U" SBSSC5        U" SDR                  5       SSSS5        U" SESS5        U" SFSS@5        U" SGSS5        U" SHSSI5        U" SJSS5        U" SKSS5        U" SLSS5        U" SMSS5        U" SNSS85        U" SOSS85        U" SPSS5        U" SQSS5        U" SRSS5        U" SSSS5        U" STSS5        U" SUSS5        U" SVSS5        U" SWSS5        g )XNzdef fact(x):
	return x!
r   rT   z1 +
r[      z def spam():
  print(1)
 print(2)   zPython = "Python" +   u   Python = "Ṕýţĥòñ" +s+   # -*- coding: cp1251 -*-
Python = "ϳ" +   cp1251rM   s   Python = "ϳ" +zx = "a   zlambda x: x = 2zf{a + b + c}z[file for str(file) in []
]   u   a = « hello » « world »z[
file
for str(file)
in
[]
]z[file for
 str(file) in []]zages = {'Alice'=22, 'Bob'=23}	   z7match ...:
    case {**rest, "key": value}:
        ...z[a b c d e f]zfor x yfff:   zf(a for a in b, c)   zf(a for a in b if a, c)zf(a, b for b in c)      zf(a, b for b in c, d)zclass foo:return 1zdef f():
  continuezdef f():
  breakz4try:
  pass
except:
  pass
except ValueError:
  passztry:
  pass
except*:
  pass   z6try:
  pass
except*:
  pass
except* ValueError:
  passz(0x+1)zx = 0xIz0010 + 2z
x = 32e-+4zx = 0o9u   α = 0xIs   α = 0xIs#   # -*- coding: iso8859-7 -*-
 = 0xIz	iso8859-7s   if 1:
            def foo():
                '''

            def bar():
                pass

            def baz():
                '''quux'''
               z"pass
pass
pass
(1+)
pass
pass
passz(1+)z[interesting
foo()
s   ﻿#coding: utf8
print('我')
r   z7f'''
            {
            (123_a)
            }'''   ztf'''
            {
            f"""
            {
            (123_a)
            }
            """
            }'''z4f"""


            {
            6
            0="""   u   b"fooжжж"z!x = [(yield i) for i in range(3)]zdef f():
  from _ import *zdef f(x, x):
  passz3{i for i in range(5) if (j := 0) for j in range(5)}&   zdef f(x):
  nonlocal xzdef f(x):
  x = 1
  global xz
nonlocal xz def f():
  global x
  nonlocal xz#from __future__ import doesnt_existzfrom __future__ import bracesz#x=1
from __future__ import divisionzfoo(1=2)zdef f():
  x, y: intz[*x for x in xs]zfoo(x for x in range(10), 100)zfor 1 in []: passz(yield i) = 2zdef f(*):
  pass)r   encoder   s     r   testSyntaxErrorOffset$ExceptionTests.testSyntaxErrorOffset   s   

+Q3gq!2Ar:#Q+;QCLh	(2Ar:h1A&na#,a4+Q211a8,a3-q!4I1bQoq!$mQ""Aq!R0'Aq"5"Aq!R0%q!Q3 	"Ar*$a+!1a(I1aP.15KQPQR 	h1iAj!QlAq!iAna#A&8!Q"	$ 	 B		 	8!Q?fa%q!,CQK  	 	  	 	 
 	 	n##%q!Q3 	11a8+Q3$a,CQK'A..15lAq!2Aq9 	3Q;-q"54a;j!Q%q!, !Q'.15!1a(oq!$!1a(r!   z)Downcasting to int is safe for col_offsetcpur   F)memusedry_runc                     SUS4-  nU R                  [        S5         [        USS5        S S S 5        g ! , (       d  f       g = f)Ns   if True:
%*ss   passzParser column offset overflowr   rc   )assertRaisesRegexrZ   rv   )r   sizer   s      r   testMemoryErrorBigSource'ExceptionTests.testMemoryErrorBigSourceM  s<     $0##M3RSCv. TSSs	   5
Ac                 P  ^ ^^  " S S[         5      m " S S5      m[        R                  " [        S L S5      UU 4S j5       n[        R                  " [        S L S5      UU 4S j5       n[        R                  " [        S L S5      UU 4S j5       nU" 5         U" 5         U" 5         g )	Nc                       \ rS rSrS rSrg)9ExceptionTests.testSettingException.<locals>.BadExceptioniZ  c                     [        S5      e)Nzcan't instantiate BadException)r]   )self_s    r   r   BExceptionTests.testSettingException.<locals>.BadException.__init__[  s    "#CDDr!   r(   Nr"   r(   r!   r   BadExceptionr   Z  s    Er!   r   c                       \ rS rSrSrg)=ExceptionTests.testSettingException.<locals>.InvalidExceptioni^  r(   Nr#   r$   r%   r&   r'   r(   r!   r   InvalidExceptionr   ^      r!   r   requires _testcapic                  R  >  [         R                  " TS5        TR                  S5        g ! [         ap  n U R                  R
                  R                  nTR                  UR                  S5        TR                  UR                  R                  S5      5         S n A g S n A ff = f)Nr[   Expected exception
test_capi1test_exceptions.py)	_testcapiraise_exceptionrw   rf   __traceback__tb_framef_coderA   co_name
assertTrueco_filenameendswith)rB   cor   r   s     r   r   7ExceptionTests.testSettingException.<locals>.test_capi1a  s    0)),: 		./  O&&//66  \: 7 78L MNNOs   , 
B&A&B!!B&c                    >  [         R                  " TS5        TR                  S5        g ! [         a  n U R                  R
                  nUR                  R                  nTR                  UR                  S5        TR                  UR                  R                  S5      5        UR                  R                  R                  nTR                  UR                  S5         S n A g S n A ff = f)Nr   r   r   r   
test_capi2)r   r   rw   r]   r   tb_nextr   r   rA   r   r   r   r   f_back)rB   tbr   co2r   r   s       r   r   7ExceptionTests.testSettingException.<locals>.test_capi2l  s    
0)),: 		./   <&&..[[''  Z8 7 78L MNkk((//  l;;<s   , 
C.B.C))C.c                  R   > TR                  [        [        R                  T S5        g Nr[   )rj   rd   r   r   )r   r   s   r   
test_capi37ExceptionTests.testSettingException.<locals>.test_capi3z  s     k9+D+D.3r!   )r4   unittestskipIfr   )r   r   r   r   r   r   s   `   @@r   testSettingException#ExceptionTests.testSettingExceptionU  s    
	E9 	E	 	 
d*,@	A	0 
B	0 
d*,@	A	0 
B	0 
d*,@	A	3 
B	3 	r!   c                     [           U R                  [         [        5        U R                  [	        [        S5      5      S5        U R                  [	        [        SS5      5      S5        [        SSS5      nU R                  UR
                  S5        U R                  UR                  S 5        U R                  [	        U5      S5        [        S	SSS
5      nU R                  UR
                  S5        U R                  UR                  S
5        U R                  UR                  S5        U R                  UR                  S5        U R                  UR                  S 5        U R                  [	        U5      S5        [        S	SS S5      nU R                  UR
                  S5        U R                  UR                  S5        U R                  UR                  S5        U R                  UR                  S 5        U R                  UR                  S 5        U R                  [	        U5      S5        [        SS5      nU R                  UR
                  S5        U R                  UR                  S 5        U R                  UR                  S5        U R                  UR                  S 5        U R                  UR                  S 5        g ! [         a     g f = f)Ni  1001messagez[Errno 1001] messager   foobarz[Errno 9] foo: 'bar'r   r   r   z[WinError 3] foo: 'bar'   z[WinError 1001] foo)WindowsErrorassertIsrP   rA   r@   errnowinerrorstrerrorfilename	filename2rY   )r   rK   s     r   test_WindowsError ExceptionTests.test_WindowsError  s6   $	0 MM,0S/8Sy!9:35 5%(AQWWa(QZZ.SV%;<5%+AQWWa(QZZ+QZZ/QZZ/Q[[$/SV%>?5$-AQWWb)QZZ.QZZ/QZZ.Q[[$/SV%:;u%AQWWe,QZZ.QZZ/QZZ.Q[[$/E  		s   K 
KKwin32ztest specific to Windowsc                     [        S5      nSnU R                  [        SU-  5         UR                  R	                  U5        S S S 5        g ! , (       d  f       g = f)Nctypesl   cs@ zWindows Error 0x%x)r   r   rP   	pythonapiPyErr_SetFromWindowsErr)r   r  codes      r   test_windows_message#ExceptionTests.test_windows_message  sJ     x(##G-AD-HI44T: JIIs   A
Ac                 n   [         S0 SS04[         S0 SS04[         S0 SS04[         S0 SS04[        S0 SSS.4[        S0 SS S S S S.4[        S	0 S	S S SS
S.4[        S0 S	SS SS
S.4[        S0 S	SSS.4[        S0 SSSSS.4[        S0 SSSSS S.4[        S0 S S S S S S S S.4[        S0 SS S SS S S S S.4[        S0 SS SS SSS!S"S#S$.	4[        S%0 S S%S SS S S S S S&.	4[        S0 SS04[
        S'0 S'S(S)S*S+S,.4[        S([        S-5      S*SS+40 S([        S-5      S*SS+4S(S-S*S+S,.4[        S.0 S.S(S-S*S+S,.4[        S/0 S/S0S1S*SS2.4[        S0 SSS3.4[        S0 SSS3.4[        S[        S4S5S69[        SS4S5S794/n UR                  [        S0 SSS SSS S8.45        U GHd  u  p#pE U" U0 UD6n[!        U5      R"                  R%                  S95      (       d%  U R'                  [!        U5      R(                  S:5        [+        U5      nU HF  n[-        Xh5      n	U R'                  [/        U	5      [/        XX   5      U< S;U< S<U	< S=XX   < 35        MH     [0        4 H  n
[3        U
R4                  S-   5       H  nU
R7                  Xk5      nU
R9                  U5      nU HZ  n[/        [-        X5      5      nU[        :X  a  US5:X  a  [/        S 5      nO[/        XX   5      nU R'                  XS>U< S?U< 35        M\     M     M     GMg     g ! [         a     GNyf = f!   [;        S@U< SAU< 3[<        R>                  SB9   GM  = f)CNr(   args)r[   )r   )r   r[   r   )r  r  )r  r   r   r   r   )r   r   r   )r   r   bazr  )r   r   r  Nquuxr  )r  r   r   )errnoStrstrErrorStrfilenameStr)r  r  r  r  r  )r  r   r   r   )r[   r  r  )r[   r  r[   )r  r   r   r   r   )r   r   r   r   r   r   print_file_and_line)msgStrr  )r  r   r  r   r   r   r   r   )r  )r  	linenoStr	offsetStrtextStrendLinenoStrendOffsetStrr  r  r  r  r  )	r   r   r  r  r   r   r   r   r   )r  r  r  r  r  r  r  print_file_and_lineStr)	r   r  r  r   r   r   r   r   r   )asciiar   r[   ordinal not in ranger  r  r   r  )r  rN   objectstartreason   )r  r  r   r[   r  )   あr   r[   ouchr   r!  )r  r  r  r  end)r  r   nameobjr#  r$  )r  r#  r$  )r  r   r   r   r   r   r   builtins.z == z, expected z	pickled "z", attribute "z
exc=z, args=)file) BaseExceptionre   rP   r_   UnicodeErrorUnicodeEncodeErrorUnicodeDecodeError	bytearrayUnicodeTranslateErrorr   r*   rH   dictappendr   rY   typer#   r   rA   r$   r@   rk   reprpickleru   HIGHEST_PROTOCOLdumpsrq   printrl   stderr)r   exceptionListr<   r  kwargsexpectedr}   r   checkArgNamevaluepprotocolnewgotwants                  r   testAttributesExceptionTests.testAttributes  s    BVbM2E27Hb(#%J*%'2"U35h"Td45 nb("$ u67 +R(#4 u67 92(u6RT@"5+z+-. 7,++4AB "b4$!dt"D#B C +r%)-x"t#%&
  GHJ')G *.x+-^MN  5685 *.x"t#49	: 2rFR>2 ":;=C%#)?AB  '9W+=q!"8":;="Ig$61+AC%')?AB   ":;=C%')?AB #$<b2$a)* Xr!.0"Hb!.0XtU'C(U;=iV
n
	  @"0"/d "/tEF ,9'Cv"@(( Aw''001ABB$$T!W%7%7DF$,L#A4E$$T%[%)(*@%A%&%*H,B&DE %- !A$)!*<*<q*@$AGGA0ggaj,4L"&ws'A"BC"n49N (,Dz'+H,B'C ,,S$./.?@ -5 %B "+ ,9  		HsgWTH5CJJGs   1 K= L=
L
L"L4c                    [        S5      nSUl        U R                  UR                  S5        U R                  UR                  S5        U R	                  [
        [        US5        U R	                  [
        [        US5        UR                  SSS.5        U R                  UR                  S5        U R                  UR                  S5        U R                  UR                  S5        U R                  UR                  S5        UR                  S	S
SS.5        U R                  UR                  S
5        U R                  UR                  S5        U R                  UR                  S	5        U R                  UR                  S5        g )N*   5   )rE  r  br[   r   )r  rG  r   )r[   r   r   #   )r  r  blah)
r4   rI  rA   r  rj   rH   rk   __setstate__r  rG  r   r}   s     r   test_setstateExceptionTests.test_setstate?  s&   bM'$.'1c:.'1c:	Qa()'$a a 	R"=>)$b!a r!   c                     [        S5      nU R                  [        S5         UR                  S5        S S S 5        g ! , (       d  f       g = f)NrE  zstate is not a dictionary)r4   r   rf   rJ  rK  s     r   test_invalid_setstate$ExceptionTests.test_invalid_setstateQ  s5    bM##I/JKNN2 LKKs	   =
Ac                    [        S5      [        S5      [        S5      4 GH  nU R                  US9   U R	                  [        US5      5        UR                  S5        U R                  UR                  S/5        U R                  [        5         UR                  S5        S S S 5        U R                  UR                  S/5        UR                  S5        U R                  UR                  SS/5        U?U R	                  [        US5      5        UR                  S	5        U R                  UR                  S	/5        SUl        U R                  UR                  S5        U R                  [        5         UR                  S
5        S S S 5        U R                  UR                  S5        S S S 5        GM     g ! , (       d  f       GN"= f! , (       d  f       NJ= f! , (       d  f       GM  = f)Nr[   r   r   r}   	__notes__zMy NoterE  z	Your NotezOur Notezwill not work)r)  r4   rg   r?   assertFalsehasattradd_noterA   rS  rj   rf   rK  s     r   
test_notesExceptionTests.test_notesV  sl   "IaL*Q-@A"  K!89

9%  yk:&&y1JJrN 2  yk:

;'  y+.FGK  K!89

:&  zl;   b1&&y1JJ/ 2  b1/ #" A 21  21+ #"s=   AG#G %CG#<G$G# 
G
G#
G G##
G3	c                 4    [        S5      e! [         a  nUR                  n S nAOS nAff = f[        5       R	                  U5      nU R                  U[        5        U R                  UR                  U5        [        S5      R	                  U5      nU R                  U[         5        U R                  UR                  U5         " S S[        5      nU" 5       R	                  U5      nU R                  X5        U R                  UR                  U5        g )Nr   r   c                       \ rS rSrSrg)5ExceptionTests.testWithTraceback.<locals>.MyExceptioni  r(   Nr   r(   r!   r   MyExceptionr[    r   r!   r\  )rS   r4   r   r)  with_tracebackassertIsInstancerA   )r   r}   r   r\  s       r   testWithTraceback ExceptionTests.testWithTracebackq  s    	!Q- 	!B	! O**2.a/"-qM((,a,"-	) 	 M((,a-"-    
-(-c                      S[        5       l        U R                  S5        g ! [         a%  nU R	                  S[        U5      5         S nAg S nAff = f)Nr   No exception raisedz!__traceback__ must be a traceback)r4   r   rw   rf   r   r@   rK  s     r   testInvalidTraceback#ExceptionTests.testInvalidTraceback  sJ    	-()IK% II+,  	GMM=s1vFF	Gs   # 
AAAc                     [         n[        5       nSnU R                  X[        USS5        SnU R                  X[        USS5        SnU R                  X[        USS5        SnU R                  X[        US	S5        g )
Nz'int' object is not iterabler  r[   z)__traceback__ must be a traceback or Noner   z9exception cause must be None or derive from BaseException	__cause__z;exception context must be None or derive from BaseException__context__)rf   r4   r   setattr)r   TEr<   r   s       r   test_invalid_setattr#ExceptionTests.test_invalid_setattr  sz    k,rfa@9roqIIrk1EKrmQGr!   c                    [         n [        S5      e! [         a  nUn S nAOS nAff = fSnU R                  X[        US5        U R                  X[        US5        U R                  X[        US5        U R                  X[        US5        g )Nr   zmay not be deletedr  r   rg  rh  )rf   rS   r4   r   delattr)r   rj  r}   r<   r   s        r   test_invalid_delattr#ExceptionTests.test_invalid_delattr  s    	Q- 	C	 #rf=roFrkBrmDs    
)$)c                      [        S5      e! [         a  nUR                  n S nAOS nAff = f[        5       nX!l        S Ul        U R                  UR                  S 5        g )Nr   )rS   r4   r   rA   )r   r}   r   s      r   testNoneClearsTracebackAttr*ExceptionTests.testNoneClearsTracebackAttr  sS    	!Q- 	!B	! K$/ra  c                    [        5       nU R                  UR                  5        U R                  UR                  5        [	        5       nU R                  UR                  5        U R                  UR                  5         " S S[
        5      nU" 5       nU R                  UR                  5        U R                  UR                  5        g )Nc                       \ rS rSrSrg)5ExceptionTests.testChainingAttrs.<locals>.MyExceptioni  r(   Nr   r(   r!   r   r\  rv    r   r!   r\  )r4   assertIsNonerh  rg  rf   rP   )r   r}   r\  s      r   testChainingAttrs ExceptionTests.testChainingAttrs  s    K!--(!++&K!--(!++&	' 	 M!--(!++&r!   c                 
    [        5       e! [          a  nUn S nAOS nAff = fU R                  UR                  5        U R                  UR                  5        U R	                  UR
                  5        [        5       Ul        S Ul        U R                  UR                  [        5        U R                  UR                  5        U R                  UR
                  5        SUl        U R	                  UR
                  5        g )NF)	r4   rw  rh  rg  rT  __suppress_context__rY   r^  r   )r   r<   r}   s      r   testChainingDescriptors&ExceptionTests.testChainingDescriptors  s    	+ 	A	 	!--(!++&//0!ammY7!++&../!&//0s   
 
""c                     U R                  [        [        SS9   " S S[        5      nU" SS9nU R                  UR                  S5        g )Nr[   )r  c                       \ rS rSrS rSrg)8ExceptionTests.testKeywordArgs.<locals>.DerivedExceptioni  c                 :    [         R                  U 5        Xl        g r   )r)  r   	fancy_arg)r   r  s     r   r   AExceptionTests.testKeywordArgs.<locals>.DerivedException.__init__  s    &&t,!*r!   r  Nr"   r(   r!   r   DerivedExceptionr    s    +r!   r  rE  r  )rj   rf   r)  rA   r  )r   r  r   s      r   testKeywordArgsExceptionTests.testKeywordArgs  sE     	)]a8	+} 	+
 r*b)r!   c                 x   ^^ U4S jmU R                  [        T5        U4S jmU R                  [        T5        g )Nc                     > T " 5       $ r   r(   )fs   r   r  /ExceptionTests.testInfiniteRecursion.<locals>.f  s
    3Jr!   c                  4   >  T " 5       $ ! [          a     gf = f)Nr   rg   gs   r   r  /ExceptionTests.testInfiniteRecursion.<locals>.g  s!    s
 s   
 
)rj   r^   )r   r  r  s    @@r   testInfiniteRecursion$ExceptionTests.testInfiniteRecursion  s/    	.!,	
 	.!,r!   c                     U R                  [        [        5      5        U R                  [        [        S5      5      5        U R                  [        [        SS5      5      5        g )Nr  rG  )r   r@   r4   r5   s    r   test_strExceptionTests.test_str  s?    I'IcN+,Ic3/01r!   c                 
    [        5       e! [          a   nU R                  U[         5         S nAOS nAff = fU R                  S[        5       5        U R	                  [
        5         W  S S S 5        g ! , (       d  f       g = fNr}   r4   r^  assertNotInlocalsrj   UnboundLocalErrorrK  s     r   test_exception_cleanup_names+ExceptionTests.test_exception_cleanup_names  sb    	0+ 	0!!!Y//	0fh'01 211s   
 
616(A44
Bc                     [        5       e! [          a!  nU R                  U[         5        A S nAOS nAff = fU R                  S[        5       5        U R	                  [
        5         W  S S S 5        g ! , (       d  f       g = fr  r  rK  s     r   test_exception_cleanup_names2,ExceptionTests.test_exception_cleanup_names2  sd    	+ 	!!!Y/	 	fh'01 211s   
 
727)A55
Bc                   ^^  " S S[         5      m " S S5      nUU4S jnU" 5       m[        R                  " T5      n U" 5         S m[        5         U" 5       mU R	                  T5        U" 5       m[        R                  " T5      n U" 5         S m[        5         U" 5       mU R	                  T5        U" 5       m[        R                  " T5      n U" 5         S m[        5         U" 5       mU R	                  T5        U" 5       m[        R                  " T5      nS H  n U" 5         M     S m[        5         U" 5       mU R	                  T5        U" 5       m[        R                  " T5      n  U" 5         U" 5       m[        R                  " T5      n U" 5         S m[        SS9(       a
  [        5         U" 5       mU R	                  T5         " S	 S
5      nU" 5       m[        R                  " T5      nU" 5          U" 5         S S S 5        S m[        SS9(       a
  [        5         U" 5       mU R	                  T5        g ! T a  n S nAGNS nAff = f! T a     GNf = f!    GN= f!      GMB  = f!   [
        e= f! [
         aN  nS Ul        S m[        5         U" 5       m[        SS9(       a
  [        5         U R	                  T5         S nAGNYS nAff = f! T a      e ! e = f! T a      GNTf = ff = f! , (       d  f       N= f)Nc                       \ rS rSrS rSrg)=ExceptionTests.testExceptionCleanupState.<locals>.MyExceptioni  c                     Xl         g r   r$  r   r$  s     r   r   FExceptionTests.testExceptionCleanupState.<locals>.MyException.__init__      r!   r  Nr"   r(   r!   r   r\  r        r!   r\  c                       \ rS rSrSrg)7ExceptionTests.testExceptionCleanupState.<locals>.MyObji  r(   Nr   r(   r!   r   MyObjr    r   r!   r  c                     > Tn T" T5      er   r(   )	local_refr\  r$  s    r   inner_raising_funcDExceptionTests.testExceptionCleanupState.<locals>.inner_raising_func  s    Ic""r!   )r   F)cpythonc                        \ rS rSrS rS rSrg)9ExceptionTests.testExceptionCleanupState.<locals>.Contextit  c                     U $ r   r(   r5   s    r   	__enter__CExceptionTests.testExceptionCleanupState.<locals>.Context.__enter__u      r!   c                     g)NTr(   )r   exc_type	exc_valueexc_tbs       r   __exit__BExceptionTests.testExceptionCleanupState.<locals>.Context.__exit__w  s    r!   r(   Nr#   r$   r%   r&   r  r  r'   r(   r!   r   Contextr  t  s    r!   r  )r4   weakrefrefr	   rw  rU   rh  r   )	r   r  r  wrr}   ir  r\  r$  s	          @@r   testExceptionCleanupState(ExceptionTests.testExceptionCleanupState
  s   	) 		 		# g[[	  d# g[[	  d# g[[	  d# g[[A"$ 
 d# g[[	#"$$ g[[		  U+Ld#	 	
 g[[Y  U+Ld#G  		  			 	#
 !AMCL$C /c""	#&  	 	, Ys   H> 
I I !I'/I1 K ;K7>I
IIII$'I.1I99I< <
KAKKK4K  K""K%%K0+K4/K00K47
Lc                 \   ^ U4S jn [           g ! [         a  mU" 5          S m@g S m@ff = f)Nc                  
   > T   g r   r(   rR  s   r   print_errorIExceptionTests.test_exception_target_in_nested_scope.<locals>.print_error  s    r!   )	somethingr4   )r   r  r}   s     @r   %test_exception_target_in_nested_scope4ExceptionTests.test_exception_target_in_nested_scope  s'    		 	MM	s    
+&+c                 N   S nU" 5       nU R                  [        U5      [        5        U R                  [        R
                  " 5       5        U R                  [        U5      [        5        U R                  [        R
                  " 5       5        U R                  [        U5      5         [        S5      e! [         a    U" 5       nU R                  [        U5      [        5        U R                  [        R
                  " 5       [        5        U R                  [        U5      [        5        U R                  [        R
                  " 5       [        5        U R                  [        U5      [        5        AU R                  [        R
                  " 5       [        5         g f = f)Nc               3      #     [        S5      e! [          a1    [        R                  " 5       v   [        R                  " 5       v    Of = f[        R                  " 5       v   g 7f)Ncaught)rU   rl   r   r(   r!   r   yield_raise:ExceptionTests.test_generator_leaking.<locals>.yield_raise  sJ     &x(( &mmo%mmo%& --/!s    A% 8A
A%	A

A%r   )r^  nextrU   rw  rl   r   rf   )r   r  r  s      r   test_generator_leaking%ExceptionTests.test_generator_leaking  s   	" Md1gx0#--/*d1gx0#--/*$q'"
	>E"" 	>A!!$q'84!!#--/9=!!$q'84!!#--/9=!!$q'95!!#--/9=	>s   ,B7 7C*F$#F$c                     S n [         e! [          a    U" 5       n[        U5         Of = f [        U5        O! [         a     Of = fU R                  [        R
                  " 5       5        g )Nc               3      #    S v   g 7fr   r(   r(   r!   r   r  1ExceptionTests.test_generator_leaking2.<locals>.g  s        )r]   r  StopIterationrw  rl   r   r   r  its      r   test_generator_leaking2&ExceptionTests.test_generator_leaking2  sa    		 	BH		H 		#--/*s    **: 
AAc                    S nU" 5       n[        U5         SS-    U R                  [        R                  " 5       5        g ! [         av  nU R                  [        R                  " 5       U5        UR                  U5      nU R                  [        R                  " 5       U5        U R                  XC5         S nANS nAff = f)Nc               3   d   #     S v   g ! [          a    [        R                  " 5       v    g f = f7fr   rh   rl   r   r(   r!   r   r  1ExceptionTests.test_generator_leaking3.<locals>.g  s'     &$ &mmo%&s   0	 0!-0-0r[   r   )r  rh   r   rl   r   throwrw  )r   r  r  r}   gen_excs        r   test_generator_leaking3&ExceptionTests.test_generator_leaking3  s    	&
 SR	&aC 	#--/* ! 	&MM#--/1-hhqkGMM#--/1-MM'%%		&s   A 
CA,B<<Cc                 t   S nU" 5       n [         e! [          a    [        [        U5      5      n Of = fU R                  U[        5         [        U5        O<! [         a/  nU R                  [
        R                  " 5       U5         S nAOS nAff = fU R                  [
        R                  " 5       5        g )Nc               3   d   #     SS-    g ! [          a    [        R                  " 5       v   e f = f7fNr[   r   r  r(   r!   r   r  1ExceptionTests.test_generator_leaking4.<locals>.g  s.     !$ mmo%s   0
 0#-0)rf   r1  r  r   rh   rl   r   rw  )r   r  r  tpr}   s        r   test_generator_leaking4&ExceptionTests.test_generator_leaking4  s    	 S	 O 	  d2hB	  	b+,	.H ! 	.MM#--/1--	. 	#--/*s$    33A 
B#%BBc                    ^  U 4S jnU" 5       n [         e! [          a    [        U5         Of = fT R                  [        [        U5        g )Nc               3      >#    T R                  [        R                  " 5       [        5        S v   T R	                  [        R                  " 5       5        g 7fr   )r^  rl   r   r]   rw  r5   s   r   r  >ExceptionTests.test_generator_doesnt_retain_old_exc.<locals>.g  s3     !!#--/<@cmmo.s   AA)r]   r  rj   r  r  s   `  r   $test_generator_doesnt_retain_old_exc3ExceptionTests.test_generator_doesnt_retain_old_exc  sD    	/ S	 	H	-r2s    ..c                    ^ S mU4S jnU" 5         [        5         U R                  [        R                  " 5       5        g )Nc               3      #    Sv   g 7fr   r(   r(   r!   r   
simple_genNExceptionTests.test_generator_finalizing_and_sys_exception.<locals>.simple_gen  s
     Gr  c                  V   > T" 5       n  [         e! [          a    [        U 5      s $ f = fr   )r]   r  )genr  s    r   run_genKExceptionTests.test_generator_finalizing_and_sys_exception.<locals>.run_gen  s.    ,C!"" !Cy !s    (()r	   rw  rl   r   )r   r  r  s     @r   +test_generator_finalizing_and_sys_exception:ExceptionTests.test_generator_finalizing_and_sys_exception  s-    		! 		#--/*r!   c                   ^^  " S S[         5      m " S S5      nUU4S jnU" 5       m[        R                  " T5      nU" 5       n[        U5        U" U5        S =nm[	        5         U" 5       mU R                  T5        g )Nc                       \ rS rSrS rSrg)FExceptionTests._check_generator_cleanup_exc_state.<locals>.MyExceptioni  c                     Xl         g r   r  r  s     r   r   OExceptionTests._check_generator_cleanup_exc_state.<locals>.MyException.__init__  r  r!   r  Nr"   r(   r!   r   r\  r    r  r!   r\  c                       \ rS rSrSrg)@ExceptionTests._check_generator_cleanup_exc_state.<locals>.MyObji	  r(   Nr   r(   r!   r   r  r  	  r   r!   r  c               3   >   >#     T " T5      e! T  a    S v    g f = f7fr   r(   )r\  r$  s   r   raising_genFExceptionTests._check_generator_cleanup_exc_state.<locals>.raising_gen  s'     !#&& s    
)r4   r  r  r  r	   rw  )r   testfuncr  r  r  r  r\  r$  s         @@r   "_check_generator_cleanup_exc_state1ExceptionTests._check_generator_cleanup_exc_state  sm    	) 		 		 g[[MQCd#r!   c                 ,    S nU R                  U5        g )Nc                 X     U R                  [        5       5        g ! [         a     g f = fr   )r  r]   r  s    r   do_throwGExceptionTests.test_generator_throw_cleanup_exc_state.<locals>.do_throw  s'    ' s    
))r  )r   r  s     r   &test_generator_throw_cleanup_exc_state5ExceptionTests.test_generator_throw_cleanup_exc_state  s    	
 	//9r!   c                 ,    S nU R                  U5        g )Nc                 $    U R                  5         g r   )rn   r  s    r   do_closeGExceptionTests.test_generator_close_cleanup_exc_state.<locals>.do_close%  s    GGIr!   r  )r   r  s     r   &test_generator_close_cleanup_exc_state5ExceptionTests.test_generator_close_cleanup_exc_state$  s    	//9r!   c                 ,    S nU R                  U5        g )Nc                     S n g r   r(   r  s    r   do_delCExceptionTests.test_generator_del_cleanup_exc_state.<locals>.do_del*  s    Ar!   r  )r   r  s     r   $test_generator_del_cleanup_exc_state3ExceptionTests.test_generator_del_cleanup_exc_state)  s    	//7r!   c                 4   ^  U 4S jnT R                  U5        g )Nc                 `   >  [        U 5        TR                  S5        g ! [         a     g f = fNz should have raised StopIteration)r  rw   r  r  r   s    r   do_nextEExceptionTests.test_generator_next_cleanup_exc_state.<locals>.do_next/  s2    >Q 		<= ! s     
--r  )r   r   s   ` r   %test_generator_next_cleanup_exc_state4ExceptionTests.test_generator_next_cleanup_exc_state.      	> 	//8r!   c                 4   ^  U 4S jnT R                  U5        g )Nc                 l   >  U R                  S 5        TR                  S5        g ! [         a     g f = fr  )sendrw   r  r  s    r   do_sendEExceptionTests.test_generator_send_cleanup_exc_state.<locals>.do_send9  s6    >t 		<= ! s   & 
33r  )r   r(  s   ` r   %test_generator_send_cleanup_exc_state4ExceptionTests.test_generator_send_cleanup_exc_state8  r$  r!   c                    ^  " U4S jS5      nSm [        U" 5       5      e!    O= f[        5         U R                  T5        g )Nc                   "   > \ rS rSrU 4S jrSrg)*ExceptionTests.test_3114.<locals>.MyObjectiE  c                 0   > [         R                  " 5       mg r   )rl   r   rK  s    r   __del__2ExceptionTests.test_3114.<locals>.MyObject.__del__F  s    MMOr!   r(   Nr#   r$   r%   r&   r0  r'   rR  s   r   MyObjectr.  E  s    $ $r!   r3  r(   )r4   r	   rw  )r   r3  r}   s     @r   	test_3114ExceptionTests.test_3114B  sC    	$ 	$ 	HJ''	!s   " &c                     " S S[         5      n " S S[         5      n " S S[         5      n  Ue! U a  nUn Ue! U a  nUn Ue! U a  nUn	U R                  XQ5        U R                  Xr5        U R                  X5        U R                  UR                  5        U R	                  UR                  U5        U R	                  U	R                  U5        UeS nAff = fS nAff = fS nAff = f! U a  n
U
n S n
A
OS n
A
ff = fU R	                  UW5        U R	                  UR                  W	5        U R	                  U	R                  W5        U R                  UR                  5        g )Nc                       \ rS rSrSrg)HExceptionTests.test_raise_does_not_create_context_chain_cycle.<locals>.AiR  r(   Nr   r(   r!   r   Ar8  R  r   r!   r9  c                       \ rS rSrSrg)HExceptionTests.test_raise_does_not_create_context_chain_cycle.<locals>.BiT  r(   Nr   r(   r!   r   Br;  T  r   r!   r<  c                       \ rS rSrSrg)HExceptionTests.test_raise_does_not_create_context_chain_cycle.<locals>.CiV  r(   Nr   r(   r!   r   Cr>  V  r   r!   r?  )r4   r^  rw  rh  r   )r   r9  r<  r?  a_r  b_rG  c_cr}   r<   s               r   .test_raise_does_not_create_context_chain_cycle=ExceptionTests.test_raise_does_not_create_context_chain_cycleQ  sG   		 			 			 		    G  A
   --a3--a3--a3))!--8ammQ7ammQ7 	 	 "  	C	 	c1ammQ'ammQ'!--(sf   2 C-C(=C%C ACB
CCC  C%%C((C--C0 0D6C==Dc                    S n U" 5         U R                  W[        5        U R                  UR                  [        5        U R                  UR                  R                  UR                  5        g ! [          a  nUn S nANxS nAff = f)Nc                  `     [        S5      e! [          a  n X l        [        S5      eS n A ff = fNr[   r   )rg   rh  rf   exs    r   cycleBExceptionTests.test_no_hang_on_context_chain_cycle1.<locals>.cycle|  s0    # m# #!#l"#s    
-(-)r4   r^  rf   rh  rg   r   )r   rK  r}   r<   s       r   $test_no_hang_on_context_chain_cycle13ExceptionTests.test_no_hang_on_context_chain_cycle1y  sj    	#	G 	c9-cooz:coo113??C  	C	s   A3 3
B	=BB	c                 $    " S S[         5      n " S S[         5      n " S S[         5      nU R                  U5       n U" 5       e! U a?  nUn U" 5       e! U a'  nUn U" 5       e! U a  n	U	n
Xl        U
eS n	A	ff = fS nAff = fS nAff = f! , (       d  f       O= fU R                  WR                  W
5        U R                  U
R                  W5        U R                  UR                  W5        U R                  UR                  U
5        g )Nc                       \ rS rSrSrg)>ExceptionTests.test_no_hang_on_context_chain_cycle2.<locals>.Ai  r(   Nr   r(   r!   r   r9  rQ    r   r!   r9  c                       \ rS rSrSrg)>ExceptionTests.test_no_hang_on_context_chain_cycle2.<locals>.Bi  r(   Nr   r(   r!   r   r<  rS    r   r!   r<  c                       \ rS rSrSrg)>ExceptionTests.test_no_hang_on_context_chain_cycle2.<locals>.Ci  r(   Nr   r(   r!   r   r?  rU    r   r!   r?  r4   rj   rh  r   r   )r   r9  r<  r?  r   _ar  _brG  _crC  s              r   $test_no_hang_on_context_chain_cycle23ExceptionTests.test_no_hang_on_context_chain_cycle2  s    		 			 			 	 q!R c	  	 #I  A c	  () 	 	  "!  	bllA&ammQ'ammQ'ammQ'se   BABBABB !A((A=	.
A8	8A=	=B  BBBB
Bc                     " S S[         5      n " S S[         5      n " S S[         5      n " S S[         5      n " S	 S
[         5      nU R                  U5       n U" 5       e! U a^  nUn U" 5       e! U aF  n	U	n
 U" 5       e! U a.  nUnXl         U" 5       e! U a  nUnU" 5       nUeS nAff = fS nAff = fS n	A	ff = fS nAff = f! , (       d  f       O= fU R                  WR                  W5        U R                  UR                  W5        U R                  UR                  W5        U R                  UR                  W
5        U R                  U
R                  W5        U R                  UR                  U5        g )Nc                       \ rS rSrSrg)>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.Ai  r(   Nr   r(   r!   r   r9  r^    r   r!   r9  c                       \ rS rSrSrg)>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.Bi  r(   Nr   r(   r!   r   r<  r`    r   r!   r<  c                       \ rS rSrSrg)>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.Ci  r(   Nr   r(   r!   r   r?  rb    r   r!   r?  c                       \ rS rSrSrg)>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.Di  r(   Nr   r(   r!   r   Drd    r   r!   re  c                       \ rS rSrSrg)>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.Ei  r(   Nr   r(   r!   r   Erg    r   r!   rh  rV  )r   r9  r<  r?  re  rh  r   rW  r  rX  rG  rY  rC  _ddr}   s                   r   $test_no_hang_on_context_chain_cycle33ExceptionTests.test_no_hang_on_context_chain_cycle3  sY   		 			 			 			 			 	 q!R$c	 $$#I $A
$c	 $()$"##I  $ "A !A"#G$$	$	$ "!* 	bllA&ammQ'ammQ'ammQ'ammQ'ammQ's   CA&&C
,C/A66C<B=?BB:	B5	BB2"B--B22B5	5B:	:B==CCC

C
Cc                       [        S5      nUe! [        S5      nUe= f! [         a  nUn S nAOS nAff = fU R                  UW5        U R                  UR                  W5        g rH  )rf   rg   r4   r   rh  )r   tever}   r<   s        r   ,test_context_of_exception_in_try_and_finally;ExceptionTests.test_context_of_exception_in_try_and_finally  s`    	q\] 	C	 	c2coor*s    ! 
727c                 B     [        S5      nUe!   [        S5      nUe= f! [        S5      nUe= f! [         a  nUn S nAOS nAff = fU R	                  UW5        U R	                  UR
                  W5        U R	                  UR
                  R
                  W5        g )Nr[   r   r   )rf   rg   rP   r4   r   rh  )r   rn  ro  oer}   r<   s         r   /test_context_of_exception_in_except_and_finally>ExceptionTests.test_context_of_exception_in_except_and_finally  s    	q\]QZ 	C	 	c2coor*coo1126s$    " 03 
A	AA	c                        [        S5      nUe!    O= f [        S5      nUe! [        S5      nUe= f! [         a  nUn S nAOS nAff = fU R                  UW5        U R                  UR                  W5        g rH  )rg   rP   r4   r   rh  )r   ro  rs  r}   r<   s        r   -test_context_of_exception_in_else_and_finally<ExceptionTests.test_context_of_exception_in_else_and_finally  s    		  ]	
 QZ QZ 	C	 	c2coor*s)   & & 7 47 
AAAc                    [        SSSSS5      nU R                  [        U5      S5        SUl        U R                  [        U5      S5        SUl        S	Ul        U R                  [        U5      S
5        SUl        U R                  [        U5      S5        SUl        U R                  [        U5      S5        [        SSSSS5      nU R                  [        U5      S5        SUl        U R                  [        U5      S5        SUl        S	Ul        U R                  [        U5      S5        SUl        U R                  [        U5      S5        SUl        U R                  [        U5      S5        [        SSSS5      nU R                  [        U5      S5        SUl        U R                  [        U5      S5        SUl        S	Ul        U R                  [        U5      S5        SUl        U R                  [        U5      S5        g )Nr  xxxxxr[   r   r   z8'baz' codec can't encode characters in position 1-4: foor   z<'baz' codec can't encode character '\x78' in position 1: fool   ESh
MQ)EzJ'baz' codec can't encode characters in position 1-4: 965230951443685724997i  zK'4000' codec can't encode characters in position 1-4: 965230951443685724997i  zN'4000' codec can't encode characters in position 1000-4: 965230951443685724997s   xxxxxz3'baz' codec can't decode bytes in position 1-4: fooz5'baz' codec can't decode byte 0x78 in position 1: foozE'baz' codec can't decode bytes in position 1-4: 965230951443685724997zF'4000' codec can't decode bytes in position 1-4: 965230951443685724997zI'4000' codec can't decode bytes in position 1000-4: 965230951443685724997xxxxz/can't translate characters in position 1-4: fooz3can't translate character '\x78' in position 1: foozAcan't translate characters in position 1-4: 965230951443685724997zDcan't translate characters in position 1000-4: 965230951443685724997)	r+  rA   r@   r"  r  rN   r  r,  r.  )r   us     r   test_unicode_change_attributes-ExceptionTests.test_unicode_change_attributes  s    ugq!U;Q![\Q!`a'Q!mn
Q!noQ!qruh1e<Q!VWQ!XY'Q!hi
Q!ijQ!lm!&!Q6Q!RSQ!WX'Q!deQ!ghr!   c                     [         [        [        4nU H-  nU R                  [	        UR                  U5      5      S5        M/     g )N )r+  r,  r.  rA   r@   __new__)r   klassesklasss      r   test_unicode_errors_no_object,ExceptionTests.test_unicode_errors_no_object6  s8    $&8:OOESu!56; r!   c           	         [        [        SS5      [        SS5      [        S5      5       H  u  pnSU-  nU R                  SX1US9   [        SXAUS5      nU R	                  [        U5      [
        5        S S S 5        U R                  S	X1US9   [        XAUS5      nU R	                  [        U5      [
        5        S S S 5        UR                  5       nU R                  S
X1US9   [        SXaUS5      nU R	                  [        U5      [
        5        S S S 5        M     g ! , (       d  f       N= f! , (       d  f       N{= f! , (       d  f       GM&  = f)Nr   r   r  r   )objlenr  r"  rL   r  	translater   )	r   ru   r?   r+  r^  r@   r.  r   r,  )r   r  r"  r  r$  r<   encodeds          r   %test_unicode_error_str_does_not_crash4ExceptionTests.test_unicode_error_str_does_not_crash<  s    #*"aL"aL!H#
E
 ,ChvL(#c2F%%c#h4 M k&3O+CR@%%c#h4 P jjlGhvL('#rJ%%c#h4 ML#
 ML PO
 MLs$   .D-D0$.E
D-	0
D>	
E	c                   ^  " S S[         5      n " S S[        US9n[        5        n [        5       e! U a  nU R	                  S5         S nAO&S nAf[         a     O  U R	                  S5         O= fS S S 5        O! , (       d  f       O= fU4S jmT" 5       nU R                  U[        [        U5      5        U R                  S	[        U5      5        g )
Nc                       \ rS rSrS rSrg)/ExceptionTests.test_badisinstance.<locals>.MetaiW  c                     [        5       er   r  )clssubclasss     r   __subclasscheck__AExceptionTests.test_badisinstance.<locals>.Meta.__subclasscheck__X  s
     l"r!   r(   N)r#   r$   r%   r&   r  r'   r(   r!   r   Metar  W  s    #r!   r  c                       \ rS rSrSrg)6ExceptionTests.test_badisinstance.<locals>.MyExceptioniZ  r(   Nr   r(   r!   r   r\  r  Z  r   r!   r\  )	metaclasszShould have raised KeyErrorz%exception should not be a MyExceptionc                  F   >  T" 5       $ ! [          a  n U s S n A $ S n A ff = fr   )r^   )r}   r  s    r   r  ,ExceptionTests.test_badisinstance.<locals>.gi  s$    s
! s   
 
   z maximum recursion depth exceeded)	r1  r4   r   rU   rw   r^  r^   r   r@   )r   r  r\  r7  r}   r<   r  s         @r   test_badisinstance!ExceptionTests.test_badisinstanceS  s    	#4 	#	)t 	 &	9j  C		ABB 9		78 	
 cc>49=8#c(Cs7   B 
5A4AB A4B  A42B  
Bc                 B    S nU" 5         [         R                  " 5         g )Nc                  T    [        5       n [        S5       H  nU R                  n M     g )Ni@B )r  ru   __dir__)or   s     r   r   3ExceptionTests.test_trashcan_recursion.<locals>.foox  s#    A9% II &r!   )r   r	   )r   r   s     r   test_trashcan_recursion&ExceptionTests.test_trashcan_recursions  s    
	 	r!   c                     [        S5        S[        -  n[        R                  " SSU5      u  p#nU R	                  US5        U R                  SU5        U R                  SU5        U R                  SU5        g )	N_testinternalcapia  if 1:
            import sys
            from _testinternalcapi import get_recursion_depth
            from test import support

            class MyException(Exception): pass

            def setrecursionlimit(depth):
                while 1:
                    try:
                        sys.setrecursionlimit(depth)
                        return depth
                    except RecursionError:
                        # sys.setrecursionlimit() raises a RecursionError if
                        # the new recursion limit is too low (issue #25274).
                        depth += 1

            def recurse(cnt):
                cnt -= 1
                if cnt:
                    recurse(cnt)
                else:
                    generator.throw(MyException)

            def gen():
                f = open(%a, mode='rb', buffering=0)
                yield

            generator = gen()
            next(generator)
            recursionlimit = sys.getrecursionlimit()
            try:
                recurse(support.exceeds_recursion_limit())
            finally:
                sys.setrecursionlimit(recursionlimit)
                print('Done.')
        -Wd-cr[   s   RecursionErrors   ResourceWarning   Done.)r   __file__r   assert_python_failurerA   r   r   r  rcoutrB   s        r   $test_recursion_normalizing_exception3ExceptionTests.test_recursion_normalizing_exception  su    )*$H I$J %::5$MQ'-(#.h$r!   r   c                     Sn[         R                  " SU5      u  p#nU R                  US5        SnU R                  XT;   U< SUS S < S3S9  U R	                  S	U5        g )
Nzif 1:
            import _testcapi
            try:
                raise _testcapi.RecursingInfinitelyError
            finally:
                print('Done.')
        r  r[   s0   RecursionError: maximum recursion depth exceededz not found in i  z... (truncated))r   r  )r   r  rA   r   r   )r   r  r  r  rB   r:  s         r   -test_recursion_normalizing_infinite_exception<ExceptionTests.test_recursion_normalizing_infinite_exception  sj     %::4FQF|>#fu+Xg-hih$r!   c                   ^^^ S nU4S jmU4S jmU4S jm[         R                  " 5       n U" S5        TTT4 H4  nU R                  US9    U" 5         U R                  S5        S S S 5        M6     [         R
                  " U5        g ! [         a     N/f = f! , (       d  f       Mn  = f! [         R
                  " U5        f = f)Nc                     Sn  [         R                  " U5         [         R                  " X-   5        g ! [         a    US-  n Of = fMH  r   )rl   setrecursionlimitr^   )ndepths     r   set_relative_recursion_limitUExceptionTests.test_recursion_in_except_handler.<locals>.set_relative_recursion_limit  sQ    E))%0 !!%'*	 & QJE s   5 AAc                  .   >  SS-    g !   T " 5          g = fr  r(   )recurse_in_excepts   r   r  JExceptionTests.test_recursion_in_except_handler.<locals>.recurse_in_except  s    $!$!#s   	 	c                  .   >  SS-    T " 5         g !    N= fr  r(   )recurse_after_excepts   r   r  MExceptionTests.test_recursion_in_except_handler.<locals>.recurse_after_except  s!    ! !"s    c                  2   >  T " 5         g !   T " 5          g = fr   r(   )recurse_in_body_and_excepts   r   r  SExceptionTests.test_recursion_in_except_handler.<locals>.recurse_in_body_and_except  s    -*,-*,s    	rT   )funcz#Should have raised a RecursionError)rl   getrecursionlimitr?   rw   r^   r  )r   r  recursionlimitr  r  r  r  s       @@@r    test_recursion_in_except_handler/ExceptionTests.test_recursion_in_except_handler  s    		+	$	#	- ..0	2(,*,@B\]\\t\,I 		"GH -, ^ !!.1 *  -, !!.1sG   B- BBB(B- 
BBBB
B*	%B- -Czcannot test Py_TRACE_REFS buildc                     Sn[        5          [        R                  " SU5      u  p#nU R                  SU5        S S S 5        g ! , (       d  f       g = f)Na+  if 1:
            import _testcapi
            class C(): pass
            def recurse(cnt):
                cnt -= 1
                if cnt:
                    recurse(cnt)
                else:
                    _testcapi.set_nomemory(0)
                    C()
            recurse(16)
        r     MemoryError)r   r   r  r   r  s        r   )test_recursion_normalizing_with_no_memory8ExceptionTests.test_recursion_normalizing_with_no_memory  sA     !"(>>tTJLBSMM.#. #""s   -A
Ac                 l   ^ ^^ SS K mSSKJm  UU U4S jnU" 5       nU" 5       nT R                  X#5        g )Nr   raise_memoryerrorc                     >  T" 5         TR                  S5        TR                  W5      $ ! [         a  n U R                  n S n A N,S n A ff = f)Nz Should have raised a MemoryError)rw   rX   r   	format_tb)r}   r   r  r   	tracebacks     r   raiseMemError6ExceptionTests.test_MemoryError.<locals>.raiseMemError  sI    >!# 		<=&&r**	  %__%s   , 
AAA)r  r   r  rA   )r   r  tb1tb2r  r  s   `   @@r   test_MemoryErrorExceptionTests.test_MemoryError  s.    
 	/	+ oo"r!   c                    SnSnU R                  [        [        R                  S5        [        R                  " S5      nU R	                  [        U5      [
        5        U R                  [        U[        5      5        U R                  UR                  5        [        R                  " SU5      nU R                  UR                  U5        [        R                  " SUS9nU R                  [        XT5      5         " S S	[        5      n[        R                  " S
UXV45      nU R                  [        Xu5      5        U R                  [        Xv5      5        U R                  UR                  U5        [        R                  " SSUSS05      nU R                  [        X5      5        U R                  UR                  S5        U R                  UR                  S5        g )NzThis is a test docstring.zThis is another test docstring.error1z_testcapi.error1z_testcapi.error2z_testcapi.error3)basec                       \ rS rSrSrg)1ExceptionTests.test_exception_with_doc.<locals>.CiE  r(   Nr   r(   r!   r   r?  r  E  r   r!   r?  z_testcapi.error4z_testcapi.error5r  r  r[   )rj   rd   r   make_exception_with_docr   r1  r   
issubclassr4   rw  __doc__rA   r  r  )	r   doc2doc4r  error2error3r?  error4error5s	            r   test_exception_with_doc&ExceptionTests.test_exception_with_doc,  s}    +0+y'H'H"	$ 223EFd6lD)
6956&..) 223EtL. 223E8>@
623	 	223Et4:;@
623
6-.. 223Er39C8E
6231%,r!   c                   ^^^ SSK Jm   " S S5      mS mUUU4S jn U" 5         U R                  S5        [        5         U R                  T" 5       S 5        g ! [         a!  nU R	                  T" 5       S 5         S nANHS nAff = f)Nr   r  c                       \ rS rSrSrg)3ExceptionTests.test_memory_error_cleanup.<locals>.CiZ  r(   Nr   r(   r!   r   r?  r  Z  r   r!   r?  c                  N   > T" 5       n [         R                  " U 5      mT" 5         g r   r  r  )rC  r?  r  r  s    r   inner7ExceptionTests.test_memory_error_cleanup.<locals>.inner]  s    AQBr!   zMemoryError not raised)r   r  rw   rX   assertNotEqualr	   rA   )r   r  r}   r?  r  r  s      @@@r   test_memory_error_cleanup(ExceptionTests.test_memory_error_cleanupT  ss    
 	0	 		 	0G II./t$  	,d++	,s   A 
B#A??Bc                   ^^^  " S S5      mS mUUU4S jm T" 5         U R                  S5        [        5         U R	                  T" 5       S 5        g ! [         a!  nU R                  T" 5       S 5         S nANHS nAff = f)Nc                       \ rS rSrSrg)6ExceptionTests.test_recursion_error_cleanup.<locals>.Cio  r(   Nr   r(   r!   r   r?  r  o  r   r!   r?  c                  N   > T" 5       n [         R                  " U 5      mT" 5         g r   r  )rC  r?  r  r  s    r   r  :ExceptionTests.test_recursion_error_cleanup.<locals>.innerr  s    AQBGr!   zRecursionError not raised)rw   r^   r  r	   rA   )r   r}   r?  r  r  s     @@@r   test_recursion_error_cleanup+ExceptionTests.test_recursion_error_cleanupl  sn    	 			3G II12t$  	,d++	,s   A 
A>A99A>c                    U R                  [        5       n[        R                  " [        5        S S S 5        U R                  WR                  R                  [        R                  UR                  5        g ! , (       d  f       NN= fr   )	rj   rP   oslistdirr  rA   r   r   ENOTDIR)r   r   s     r   test_errno_ENOTDIR!ExceptionTests.test_errno_ENOTDIR  sP    w'2JJx  (++U]]BLLI ('s   A99
Bc                 D    " S S5      nU" 5       n[         R                  " 5        nA[        5         U R                  UR                  R
                  UR                  5        U R                  UR                  R                  5        S S S 5        g ! , (       d  f       g = f)Nc                       \ rS rSrS rSrg)1ExceptionTests.test_unraisable.<locals>.BrokenDeli  c                     [        S5      nUe)Nzdel is brokenr  r   r<   s     r   r0  9ExceptionTests.test_unraisable.<locals>.BrokenDel.__del__  s     1	r!   r(   Nr2  r(   r!   r   	BrokenDelr    s    r!   r  )	r   catch_unraisable_exceptionr	   rA   
unraisabler  r0  assertIsNotNoneexc_traceback)r   r  r$  r   s       r   test_unraisableExceptionTests.test_unraisable  so    	 	 k//1RLR]]1193D3DE  !<!<= 211s   A!B
Bc           	         [         [        4 H  nU R                  U5          U" S5      nUe   g ! U aN    [        5        n[        R
                  " [        R                  " 5       6   S S S 5         O! , (       d  f        O= ff = fWR                  5       nU R                  SU5        U R                  SU5        U R                  UR                  U5        U[        L a  U R                  SU5        OU R                  SU5        U R                  UR                  S5      5        S S S 5        GM#  ! , (       d  f       GM3  = f)Nztest messager   z	raise excz<exception str() failed>r   )rg   r0   r?   r   rl   __excepthook__exc_infogetvaluer   r#   r   r   )r   r  r<   r7  reports        r   test_unhandledExceptionTests.test_unhandled  s    #%78Hh'<">2CI 9   <(*f**CLLN; +***<  *2F;k62h//811MM"<fEMM.&9 56! ('''sE   D0
0B 'A1	'B/D01
B ;B>D0 BB!D00
E 	c                     Sn[        SS5       HC  n[        R                  " SX-  5      u  p4nU R                  US5        U R                  SU5        ME     g )Nzif 1:
            import _testcapi
            class C(): pass
            _testcapi.set_nomemory(0, %d)
            C()
        r[   r   r  )r[   x   r  )ru   r   r  r   )r   r  r  r  r  rB   s         r   "test_memory_error_in_PyErr_PrintEx1ExceptionTests.test_memory_error_in_PyErr_PrintEx  sO     q"A(>>tTXNLBSMM"h'MM.#. r!   c                   ^^  " S S[         5      m " S S[         5      mUU4S jnU" 5       nUR                  S 5        U R                  T5         UR                  T" 5       5        S S S 5        g ! , (       d  f       g = f)Nc                       \ rS rSrSrg)BExceptionTests.test_yield_in_nested_try_excepts.<locals>.MainErrori  r(   Nr   r(   r!   r   	MainErrorr    r   r!   r  c                       \ rS rSrSrg)AExceptionTests.test_yield_in_nested_try_excepts.<locals>.SubErrori  r(   Nr   r(   r!   r   SubErrorr    r   r!   r  c               3   T   >#     T " 5       e! T  a     S v   e ! T a     e f = ff = f7fr   r(   )r  r  s   r   main=ExceptionTests.test_yield_in_nested_try_excepts.<locals>.main  sE     k!     s(   ( %%!%!%()r4   r'  rj   r  )r   r  coror  r  s      @@r    test_yield_in_nested_try_excepts/ExceptionTests.test_yield_in_nested_try_excepts  s\    		 		y 		 v		$y)JJxz" *))s   A11
A?c                    ^  U 4S jnU" 5       n [         e! [          a    T R                  [        U5      S5         Of = fT R                  [        U5      S5        g )Nc               3      >#     [         e! [          a    Sv    Of = fT R                  [        R                  " 5       5        Sv   g 7frH  )rg   rw  rl   r   r5   s   r   r  ?ExceptionTests.test_generator_doesnt_retain_old_exc2.<locals>.g  s>        cmmo.Gs   A A,Ar[   r   )rS   rA   r  )r   r  r  s   `  r   %test_generator_doesnt_retain_old_exc24ExceptionTests.test_generator_doesnt_retain_old_exc2  sS    	 c	+ 	+T#Y*	+cA&s    %>>c                     S nU R                  [        5         U" 5       n SS-    S S S 5        g !   [        U5        [        U5         N#= f! , (       d  f       g = f)Nc               3      #    Sv   e 7fr   r(   r(   r!   r   r  1ExceptionTests.test_raise_in_generator.<locals>.g  s     Gr  r[   r   )rj   rh   r  )r   r  r  s      r   test_raise_in_generator&ExceptionTests.test_raise_in_generator  sQ    	
 01A! 21QQ 21s   A0A
A
Az Won't work if __debug__ is Falsec                     [         q BU R                  S5        g ! [         a<  nBU R	                  U[        5        U R                  [        U5      S5         S nAg S nAff = f)Nr   hello)rf   AssertionErrorrw   r)  r^  rA   r@   rK  s     r   test_assert_shadowing$ExceptionTests.test_assert_shadowing  s\    
 #	, II*+  	.!!!^4SVW--	.s   
A!2AA!c                      " S S[         5      n [         e! [          a  nUn S nA UeS nAff = f! [         a     Of = f[        S5       H+  n [         e! [          a
  n S nAOS nAff = f[        5         M-     g )Nc                       \ rS rSrSrg)BExceptionTests.test_memory_error_subclasses.<locals>.TestExceptioni  r(   Nr   r(   r!   r   TestExceptionr5    r   r!   r6  rT   )rX   r4   ru   r	   )r   r6  r<   inst_s        r   test_memory_error_subclasses+ExceptionTests.test_memory_error_subclasses	  s    	K 		 	D			
  		 rA!!  L s.    
/*2 /
??A
A+&A+c                     S[         R                   S3n[        R                  " SU5      u  p#nU R	                  SU5        g )NzOif 1:
            import _testcapi
            _testcapi.run_in_subinterp("[0]*z")
            exit(0)
        r  r  )rl   maxsizer   assert_python_okr   )r   r  r  r8  rB   s        r   test_memory_error_in_subinterp-ExceptionTests.test_memory_error_in_subinterp'  sB    ..1kk] ;	
 #33D$?
snc*r!   c                    [        S5        SnU[        S5      -   n[        5          [        R                  " SU5       nUR                  5         UR                  R                  5       nS S S 5        S S S 5        U R                  WR                  S5        U R                  [        W5      S5        U R                  SU5        g ! , (       d  f       N`= f! , (       d  f       Ni= f)Nr   a  a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
a = list(range(0, 1))
z
            try:
                import _testcapi
                _testcapi.set_nomemory(0)
                b = list(range(1000, 2000))
            except Exception as e:
                import traceback
                traceback.print_exc()
            r  )r   r[   r   r  )r   r   r   r   spawn_pythonwaitstdoutreadr   
returncodeassertGreaterlen)r   warmup_code
user_inputr=  outputs        r   test_exec_set_nomemory_hang*ExceptionTests.test_exec_set_nomemory_hang6  s    
 	k" 5 6 + $ 
 !"++D*= > #
 	allF+3v;*nf- >= #"s"   C+C)C
C	C
C"r(   )NNrL   )]r#   r$   r%   r&   rE   r~   r   r   r   r   r   r   r   r   rl   r<  r   requires_resource
bigmemtestr   r   r   r   
skipUnlessplatformr  rB  rL  rO  rW  r_  rd  rk  ro  rr  rx  r|  r  r
   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r"  r*  r4  rD  rM  rZ  rk  rp  rt  rw  r}  r  r  r  r  r  r   r   r  r  Py_TRACE_REFSr  r  r  r  r  r  r
  r  r  r"  r'  r,  r1  r9  r>  rK  r'   r(   r!   r   r9   r9   0   s   4RChI0'QR7"2b)H __W+-XYu%59/ : & Z/
 + +Z%0N 035;5;I@V!$
26.*-
HE	0' 1$* 
- 
-2		wr><++&+6
3+2::
8
99&)PD&"(H-(^+7$+$#iJ<5. D D> u% &  5% 5%n __Y$&(<=%  > %$,2^  __W**,MN__Y$&(<=/ > O 
/* __Y$&(<=# > #$ __Y$&(<=$- > $-L __Y$&(<=% > %, % %(J> 7*  __W**,MN__Y$&(<=/ > O 
/ #.'$ $FG, H,< __Y$&(<=+ >+  __W**,MN. O .r!   r9   c                   ,    \ rS rSrS rS rS rS rSrg)NameErrorTestsiW  c                 x     [           g ! [         a&  nU R                  SUR                  5         S nAg S nAff = f)Nbluch)rU  rY   rA   r#  r  s     r   test_name_error_has_name'NameErrorTests.test_name_error_has_nameX  s1    	0 	0Wchh//	0s   	 
949c                 ^  ^  U 4S jn U" 5         T R                  S5        T R                  SWR                  5       5        g ! T R                   aZ    [        R                  " 5        n[        R
                  " [        R                  " 5       6   S S S 5         Mx  ! , (       d  f        N= ff = f)Nc                  r   > T R                  [        S5         [          S S S 5        g ! , (       d  f       g = f)Naaa)r   rY   aabr5   s   r   r  )NameErrorTests.test_issue45826.<locals>.f`  s"    ''	59 :99s   (
6z%assertRaisesRegex should have failed.r[  )	rw   failureExceptionr   r   rl   r  r  r   r  r   r  rB   s   `  r   test_issue45826NameErrorTests.test_issue45826^  s}    		?C
 II=>eS\\^, $$ 	4((*c""CLLN3 +***	4s)   A %B,''BB,
B(	#B,(B,c                 h   S n U" 5         U R                  SWR                  5       5        U R                  SUR                  5       5        g ! [          aZ    [        R                  " 5        n[        R                  " [        R
                  " 5       6   S S S 5         M  ! , (       d  f        N= ff = f)Nc                  l     [           g ! [         a   n U R                  S 5        [        5       eS n A ff = fr   )nonsenser)  r]  rh   )rh  s    r   r  1NameErrorTests.test_issue45826_focused.<locals>.fo  s1    *  *  &'))*s   	 
3.3rc  rh   )rh   r   r   rl   r  r  r   r  r^  s      r   test_issue45826_focused&NameErrorTests.test_issue45826_focusedn  s~    	*	4C
 	j#,,.1)3<<>: ! 	4((*c""CLLN3 +***	4s)   A B1,'BB1
B-	(B1-B1c                 6    S nU R                  [        U5        g )Nc                      ^   " U 4S jS5      m g )Nc                      > \ rS rSr Y   Srg);NameErrorTests.test_gh_111654.<locals>.f.<locals>.TestClassi  r(   Nr   	TestClasss   r   rl  rj    s    r!   rl  r(   rk  s   @r   r  (NameErrorTests.test_gh_111654.<locals>.f  s     r!   )rj   rY   r   r  s     r   test_gh_111654NameErrorTests.test_gh_111654  s    	 	)Q'r!   r(   N)	r#   r$   r%   r&   rV  r_  re  ro  r'   r(   r!   r   rS  rS  W  s    0- ;"(r!   rS  c                   &    \ rS rSrS rS rS rSrg)AttributeErrorTestsi  c                     [        S5      nU R                  UR                  5        U R                  UR                  5        [	        5       n[        SSUS9nU R                  UR                  S5        U R                  UR                  U5        g )NzOuch!Ouchcarryr%  )rH   rw  r#  r$  r  rA   r   )r   r<   sentinels      r   test_attributes#AttributeErrorTests.test_attributes  sk    W%#((##''"8V'x@7+cggx(r!   c                     " S S5      nU" 5       n UR                      [
        R                  US5        g ! [         aA  nU R                  SUR                  5        U R                  X#R                  5         S nAN^S nAff = f! [         aA  nU R                  SUR                  5        U R                  X#R                  5         S nAg S nAff = f)Nc                       \ rS rSrSrSrg)<AttributeErrorTests.test_getattr_has_name_and_obj.<locals>.Ai  Nr(   r#   r$   r%   r&   blechr'   r(   r!   r   r9  r{    s    Er!   r9  rU  )rU  rH   rA   r#  r$  r  __getattribute__r   r9  r$  r<   s       r   test_getattr_has_name_and_obj1AttributeErrorTests.test_getattr_has_name_and_obj  s    	 	 c	+II	+##C1	  	+Wchh/S''**	+
  	+Wchh/S''**	+s,   7 B 
B7A==B
C7CCc                      " S S5      nU" 5       n UR                  5         g ! [         aA  nU R                  SUR                  5        U R                  X#R                  5         S nAg S nAff = f)Nc                       \ rS rSrS rSrg)GAttributeErrorTests.test_getattr_has_name_and_obj_for_method.<locals>.Ai  c                     g r   r(   r5   s    r   r}  MAttributeErrorTests.test_getattr_has_name_and_obj_for_method.<locals>.A.blech  s    r!   r(   Nr|  r(   r!   r   r9  r    s    r!   r9  rU  )rU  rH   rA   r#  r$  r  s       r   (test_getattr_has_name_and_obj_for_method<AttributeErrorTests.test_getattr_has_name_and_obj_for_method  s\    	 	 c	+IIK 	+Wchh/S''**	+s   $ 
A/7A**A/r(   N)r#   r$   r%   r&   rw  r  r  r'   r(   r!   r   rr  rr    s    	)+ 
+r!   rr  c                   ,    \ rS rSrS rS rS rS rSrg)ImportErrorTestsi  c                 \   [        S5      nU R                  UR                  5        U R                  UR                  5        [        SSS9nU R	                  UR                  S5        U R                  UR                  5        [        SSS9nU R	                  UR                  S5        U R                  UR                  5        [        SSSS9nU R	                  UR                  S5        U R	                  UR                  S5        SnU R                  [        U5         [        SS	S
9  S S S 5        U R                  [        U5         [        SSS	S9  S S S 5        U R                  [        U5         [        SSS	S9  S S S 5        U R                  [        U5         [        S	S
9  S S S 5        U R                  [        U5         [        SS	SS9  S S S 5        g ! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       Nl= f! , (       d  f       g = f)Ntest
somemoduler#  somepathpathsomename)r  r#  z<ImportError\(\) got an unexpected keyword argument 'invalid'keyword)invalidr#  )r#  r  r  )r  r  T)r  another)rQ   rw  r#  r  rA   r   rf   )r   r<   r   s      r   rw   ImportErrorTests.test_attributes  s   &!#((##((#&|4<0#((#&z2:.#((#&z
C:.:.M##Is3	2 4 ##Is3VY? 4 ##Is3VY? 4 ##Is3	* 4 ##Is3	4@ 43 43 43 43 43 43s<   GG*2G;
HH
G'*
G8;
H	
H
H+c                    [        SSSS9nU R                  UR                  S5        U R                  UR                  S5        U R                  UR                  S5        U R                  UR
                  S5        UR                  5         U R                  UR                  S5        U R                  UR                  S 5        U R                  UR                  S 5        U R                  UR
                  S 5        g )Nr  r#  r  r#  r  r  r(   )rQ   rA   r  r   r#  r  r   r  s     r   test_reset_attributes&ImportErrorTests.test_reset_attributes  s    &vF;9-&)6*6* 	2&$'4(4(r!   c                     [        S[        4SS9   Sn[        U5      nU R                  [	        U5      [	        U5      5        S S S 5        g ! , (       d  f       g = f)Nr  T)quiets   abc)r   BytesWarningrQ   rA   r@   )r   argr<   s      r   test_non_str_argument&ImportErrorTests.test_non_str_argument  sD    R.d;Cc"CSXs3x0 <;;s   2A
Ac                 |   [        5       [        SS9[        SS9[        SSS94 GH  n[        S0 UD6n[        [        R                  S-   5       H  n[        R
                  " [        R                  " X#5      5      nU R                  UR                  S5        U R                  UR                  S5        U R                  UR                  UR                  5        U R                  UR                  UR                  5        M     [        R                  [        R                  4 H  nU" U5      nU R                  UR                  S5        U R                  UR                  S5        U R                  UR                  UR                  5        U R                  UR                  UR                  5        M     GM     g )	Nr  r  r  r  r  r  r[   r  )r/  rQ   ru   r3  r4  rq   r5  rA   r  r   r#  r  copydeepcopy)r   r9  origprotor<   rC  s         r   test_copy_pickle!ImportErrorTests.test_copy_pickle  s?   v,,*=?F 00Dv66:;ll6<<#<=  95  &1  4995  4995 < YY-g  95  &1  4995  4995 .?r!   r(   N)	r#   r$   r%   r&   rw  r  r  r  r'   r(   r!   r   r  r    s     AD)16r!   r  c                    [        U [        5      (       a3  [        [        SSS9 nUR	                  [        U 5      5        S S S 5        O*[        [        S5       nUR	                  U 5        S S S 5        [        R                  " SSS[        5      u  p#nUR                  S5      R                  5       $ ! , (       d  f       NM= f! , (       d  f       N^= f)NrK   rL   rM   wbr  z-Xutf8)
r   r@   rm   r   writer   r   r  r   
splitlines)r   testfile_rc_outrB   s        r   
run_scriptr    s    &#&#0HNN6&>* 10 &$8NN6"  "88ffUNCs::g))++ 10  s   B2C2
C 
Cc                   :    \ rS rSrS r\S 5       r\S 5       rSrg)AssertionErrorTestsi  c                 "    [        [        5        g r   )r   r   r5   s    r   tearDownAssertionErrorTests.tearDown  s	    vr!   c                    S/ SQ4S/ SQ4S/ SQ4S/ SQ4S	/ S
Q4S	R                  5       / S
Q4SR                  S5      / S
Q4[        S	R                  5       -   / S
Q4S/ SQ4S/ SQ4S/ SQ4/nU H=  u  p#U R                  US9   [        U5      nU R	                  USS  U5        S S S 5        M?     g ! , (       d  f       MQ  = f)Nzassert None)z    assert Nonez           ^^^^r0  zassert 0)z    assert 0z           ^r0  zassert 1 > 2)z    assert 1 > 2           ^^^^^r0  zassert 1 > 2 and 3 > 2)z    assert 1 > 2 and 3 > 2z           ^^^^^^^^^^^^^^^r0  u   assert 1 > 2, "messäge")u       assert 1 > 2, "messäge"r  u   AssertionError: messägeu)   # coding: latin1
assert 1 > 2, "messäge"latin1z<
             assert (
                 1 > 2)
             )z
    1 > 2)	    ^^^^^r0  zG
             assert (
                 1 > 2), "Message"
             )z    1 > 2), "Message"r  AssertionError: MessagezZ
             assert (
                 1 > 2), \
                 "Message"
             )z    1 > 2), \r  r  r   )r   r   r?   r  rA   r   casesr   r:  results        r   test_assertion_error_location1AssertionErrorTests.test_assertion_error_location  s        & ( (..0 :@@J 299;;				

_Z
v !&FV,#F+  h7 -, !&,,s   !B00
B?	c                     SSS/4S/ SQ4/nU HG  u  p#U R                  US9   [        U5      nU R                  U[        U5      * S  U5        S S S 5        MI     g ! , (       d  f       M[  = f)NzJ
             assert (
                 1 > 2
             )
             z	    1 > 2r0  ze
             assert (
                 1 < 2 and
                 3 > 4
             )
             )z    1 < 2 andz	    3 > 4r0  r  )r?   r  rA   rG  r  s        r   test_multiline_not_highlighted2AssertionErrorTests.test_multiline_not_highlightedq  s      $	
0 !&FV,#F+  X!8(C -, !&,,s   +A
A*	r(   N)	r#   r$   r%   r&   r  r   r  r  r'   r(   r!   r   r  r    s4     _8 _8B D Dr!   r  c                   X    \ rS rSrSr\S 5       rS rS rS r	S r
S rS	 rS
 rS rSrg)SyntaxErrorTestsi  Nc                    S[        S5      4S[        S5      4S[        S5      4S[        S5      4S[        S	5      4S
[        S	5      4S[        S	5      4S[        S	5      4S[        S5      4/	nU H   u  p#U R                  US9    [        SU5      e   g ! [         a  n[        R                  " 5        n[
        R                  " [
        R                  " 5       6   S S S 5        O! , (       d  f       O= fU R                  UWR                  5       5        Un S nAOS nAff = f S S S 5        M  ! , (       d  f       M  = f)Nbad.pyr[   r   abcdefgr[   r   z
               File "bad.py", line 1
                 abcdefg
                  ^^^^^
             SyntaxError: bad bad
             )r  r[   r   r  r[   r   z
               File "bad.py", line 1
                 abcdefg
                  ^
             SyntaxError: bad bad
             )r  r[   r   r  r[   )r  r[   r   r  r[   r   z
               File "bad.py", line 1
                 abcdefg
                    ^
             SyntaxError: bad bad
             )r  r[   r  r[   r  zn
               File "bad.py", line 1
                 abcdefg
             SyntaxError: bad bad
             )r  r[   r  r  r[   r  )r  r[   r   r  r[   r   )r  r[   r   r  r[   r   r  r[   r   r  r[   d   z
               File "bad.py", line 1
                 abcdefg
                  ^^^^^^
             SyntaxError: bad bad
             )r  bad bad)
r   r?   r_   r   r   rl   r  r  r   r  )r   r  r  r:  r<   rB   the_exceptions          r   test_range_of_offsets&SyntaxErrorTests.test_range_of_offsets  sv    / / 0 / 1 1 / / 1MN
^ $ND4((%i66 $ # ( 002c**CLLN; 322MM(CLLN;$'M	( " )(((sH   D0B
D" D5'C%		D%
C3/)DD0D""D00
D?	c                 N    " S S[         5      n U" SS5      e! [          a  n[        R                  " 5        n[        R                  " [        R
                  " 5       6   S S S 5        O! , (       d  f       O= fU R                  SWR                  5       5         S nAg S nAff = f)Nc                       \ rS rSrSrg)5SyntaxErrorTests.test_subclass.<locals>.MySyntaxErrori  r(   Nr   r(   r!   r   MySyntaxErrorr    r   r!   r  r  r  z0
  File "bad.py", line 1
    abcdefg
     ^^^^^
)r_   r   r   rl   r  r  r   r  )r   r  r<   rB   s       r   test_subclassSyntaxErrorTests.test_subclass  s    	K 				+LMM 	((*c""CLLN3 +**MM  	\\^	 	s+   	 
B$B'A) 	B)
A7	3'BB$c                 2   U R                  [        [        5        Sn[        UR	                  S5      5      nU R                  US   S5        U R                  US   S5        Sn[        U5      nU R                  US   S5        U R                  US   S	5        g )
NuU   # -*- coding: cp437 -*-
"┬ó┬ó┬ó┬ó┬ó┬ó" + f(4, x for x in range(1))
cp437r  u@       "┬ó┬ó┬ó┬ó┬ó┬ó" + f(4, x for x in range(1))r  z-                          ^^^^^^^^^^^^^^^^^^^z# -*- coding: ascii -*-

(
z    (z    ^)
addCleanupr   r   r  r   rA   )r   r   rB   s      r   test_encodingsSyntaxErrorTests.test_encodings  s    'M 	 w/0R"deR"QR 2 R'*R'*r!   c                 x    U R                  [        [        5        [        S5      nU R	                  SUS   5        g )N   z8SyntaxError: Non-UTF-8 code starting with '\x89' in filer   )r  r   r   r  r   r   rB   s     r   test_non_utf8SyntaxErrorTests.test_non_utf8	  s0    '!QSVWYSZ[r!   c                   ^  U 4S jnU" S5      nT R                  [        U5      S5        T R                  UR                  5        T R                  UR                  S5        T R                  UR
                  S5        U" SR                  5       5      nT R                  [        U5      S5        T R                  UR                  5        T R                  UR                  S5        T R                  UR
                  S5        U" [        SR                  5       -   5      nT R                  [        U5      S5        T R                  UR                  5        T R                  UR                  S5        T R                  UR
                  S5        U" SR                  S5      5      nT R                  [        U5      S5        T R                  UR                  5        T R                  UR                  S5        T R                  UR
                  S5        U" S	5      nT R                  [        U5      S5        T R                  UR                  5        T R                  UR                  S5        T R                  UR
                  S5        U" S
5      nT R                  [        U5      S5        T R                  UR                  5        T R                  UR                  S5        T R                  UR
                  S5        g )Nc                    > TR                  [        5       n[        U SS5        S S S 5        UR                  $ ! , (       d  f       WR                  $ = f)Nrb   rc   )rj   r_   rv   r   )r   r   r   s     r   try_compile8SyntaxErrorTests.test_string_source.<locals>.try_compile	  sA    "";/2
F3 0<< 0/<<s	   9
A   return "ä"z,'return' outside function (<string>, line 1)r[         # coding: latin1
return "ä"r  z,'return' outside function (<string>, line 2)  return "ä" #ääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääää  return "ä" # ääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääää)rA   r@   rw  r   r   r   r   r   )r   r  r<   s   `  r   test_string_source#SyntaxErrorTests.test_string_source	  sE   	 
 -(S#QR#((#Q',-..01S#QR#((#Q',(]%9%9%;;<S#QR#((#Q',9@@JKS#QR#((#Q',56S#QR#((#Q',67S#QR#((#Q',r!   c                    U R                  [        [        5        [        S5      nU R	                  USS  / SQ5        [        SR                  5       5      nU R	                  USS  / SQ5        [        [        SR                  5       -   5      nU R	                  USS  / SQ5        [        SR                  S5      5      nU R	                  USS  / SQ5        [        S5      nU R	                  USS  SS	/5        U R	                  US   S S
 S5        [        S5      nU R	                  USS  SS	/5        U R	                  US   S S
 S5        g )Nr  r  )u       return "ä"z    ^^^^^^^^^^&SyntaxError: 'return' outside functionr  r  r  r  z    ^^^^^^^^^^^r  r  u       return "ä" #äääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääär  u       return "ä" # äääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääääää)r  r   r   r  rA   r   r   r  s     r   test_file_source!SyntaxErrorTests.test_file_source?	  sm   ''RS $C 	D
 --/0RS $C 	D
 M$8$8$::;RS $C 	D
 8??IJRS $C 	D
 45RS*A$C 	D 	R#(EF56RS*A$C 	D 	R#(FGr!   c                    Sn[        SU5      nUu  p4pVpxU R                  X2R                  5        U R                  XBR                  5        U R                  XrR                  5        U R                  XRR
                  5        U R                  XR                  5        U R                  XbR                  5        U R                  SUR                  5        g )Nr  r  	r_   rA   r   r   r   r   r   r   r   )	r   r  r  r   r   r   errorr   r   s	            r   test_attributes_new_constructor0SyntaxErrorTests.test_attributes_new_constructore	  s    2#It4BF?&#9#9:!5!56%=%=>!5!56%=%=> 2 23M$5$56r!   c                    Sn[        SU5      nUu  p4pVU R                  X2R                  5        U R                  XBR                  5        U R                  S UR                  5        U R                  XRR
                  5        U R                  S UR                  5        U R                  XbR                  5        U R                  SUR                  5        g )N)r  r[   r   r  r  r  )r   r  r  r   r   r   r  s          r   test_attributes_old_constructor0SyntaxErrorTests.test_attributes_old_constructorq	  s    *#It4*.'&#9#9:!5!56}778!5!56}778 2 23M$5$56r!   c                     SnU R                  [        [        SU5        SnU R                  [        [        SU5        SnU R                  [        [        SU5        g )N)r  r[   r   r  )r  r[   r   r   r   r   r   )r  r[   r   r  r[   )rj   rf   r_   r   r  s     r   test_incorrect_constructor+SyntaxErrorTests.test_incorrect_constructor}	  sM    )[)TB+)[)TB-)[)TBr!   r(   )r#   r$   r%   r&   maxDiffr   r  r  r  r  r  r  r  r  r  r'   r(   r!   r   r  r    sI    GX( X(t+ \(-T$HL
7
7Cr!   r  c                       \ rS rSrS rSrg)TestInvalidExceptionMatcheri	  c                    U R                  [        5          [        e! S a     Of = f S S S 5        O! , (       d  f       O= fU R                  [        5          [        e! [        S4 a     Of = f S S S 5        g ! , (       d  f       g = f)NrE  )rj   rf   rg   r5   s    r   'test_except_star_invalid_exception_typeCTestInvalidExceptionMatcher.test_except_star_invalid_exception_type	  s}    y)   	 *)) y)  # 	 *))sG   4'4'4
AA>A""A1.A>0A11A>>
Br(   N)r#   r$   r%   r&   r  r'   r(   r!   r   r  r  	  s    r!   r  c                   V    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rSrg)PEP626Testsi	  c                     U" 5         U R                  S5        / nWR                  nU(       ab  UR                  nUR                  UR                  c  S O"UR                  UR                  R                  -
  5        UR                  nU(       a  Mb  U R                  [        U5      U5        g ! [         a  nUR                  n S nANS nAff = f)Nrc  )rw   r4   r   r   r   r0  f_linenor   co_firstlinenorA   tuple)r   r  r:  rJ  tlinesframes          r   lineno_after_raisePEP626Tests.lineno_after_raise	  s    	-C II+,IIJJELL.u||::: 		A a 	ux0  	!  A	!s   B- -
C7CCc                 .    S nU R                  US5        g )Nc                      SS-    g r  r(   r(   r!   r   simple:PEP626Tests.test_lineno_after_raise_simple.<locals>.simple	  s    aCr!   r[   r  )r   r  s     r   test_lineno_after_raise_simple*PEP626Tests.test_lineno_after_raise_simple	  s    	 	*r!   c                 .    S nU R                  US5        g )Nc                  (     SS-    g !   SS-     g = fr  r(   r(   r!   r   	in_except@PEP626Tests.test_lineno_after_raise_in_except.<locals>.in_except	  s    !!s    r   r  )r   r  s     r   !test_lineno_after_raise_in_except-PEP626Tests.test_lineno_after_raise_in_except	  s    	 		1-r!   c                 .    S nU R                  US5        g )Nc                  >     SS-    g ! [          a
  n  S n A g S n A ff = fr  )rf   rI  s    r   other_except@PEP626Tests.test_lineno_after_other_except.<locals>.other_except	  s!    ! s    
r   r  )r   r  s     r   test_lineno_after_other_except*PEP626Tests.test_lineno_after_other_except	  s    	
 	a0r!   c                 .    S nU R                  US5        g )Nc                  H     SS-    g ! [          a  n SS-     S n A g S n A ff = fr  r3   rI  s    r   in_named_except@PEP626Tests.test_lineno_in_named_except.<locals>.in_named_except	  s(    ! !s    
!!r   r  )r   r%  s     r   test_lineno_in_named_except'PEP626Tests.test_lineno_in_named_except	  s    	 	3r!   c                 .    S nU R                  US5        g )Nc                       SS-    g ! f = fr  r(   r(   r!   r   in_try.PEP626Tests.test_lineno_in_try.<locals>.in_try	  s    !s    
r   r  )r   r+  s     r   test_lineno_in_tryPEP626Tests.test_lineno_in_try	  s    	
 	*r!   c                 .    S nU R                  US5        g )Nc                  &      SS-    g ! SS-    f = fr  r(   r(   r!   r   in_finally_normalDPEP626Tests.test_lineno_in_finally_normal.<locals>.in_finally_normal	  s"    ! !s   r   r  )r   r1  s     r   test_lineno_in_finally_normal)PEP626Tests.test_lineno_in_finally_normal	      	 	 115r!   c                 .    S nU R                  US5        g )Nc                  .     SS-    SS-    g ! SS-    f = fr  r(   r(   r!   r   in_finally_exceptDPEP626Tests.test_lineno_in_finally_except.<locals>.in_finally_except	  s&    !! !s    r   r  )r   r8  s     r   test_lineno_in_finally_except)PEP626Tests.test_lineno_in_finally_except	  r5  r!   c                 J   ^  " S S5      mU4S jnU R                  US5        g )Nc                        \ rS rSrS rS rSrg)0PEP626Tests.test_lineno_after_with.<locals>.Noopi	  c                     U $ r   r(   r5   s    r   r  :PEP626Tests.test_lineno_after_with.<locals>.Noop.__enter__	  r  r!   c                     g r   r(   r  s     r   r  9PEP626Tests.test_lineno_after_with.<locals>.Noop.__exit__	  s    r!   r(   Nr  r(   r!   r   Noopr>  	  s    r!   rC  c                  T   > T " 5          SS-     S S S 5        g ! , (       d  f       g = fr  r(   )rC  s   r   
after_with6PEP626Tests.test_lineno_after_with.<locals>.after_with	  s    ! s   
'r   r  )r   rE  rC  s     @r   test_lineno_after_with"PEP626Tests.test_lineno_after_with	  s$    	 	
	 	
A.r!   c                     S nU R                  US5        UR                  R                  SS9Ul        U R                  US 5        g )Nc                      SS-    g r  r(   r(   r!   r   r  8PEP626Tests.test_missing_lineno_shows_as_none.<locals>.f	  s	    aCr!   r[   s   )co_linetable)r  __code__r   rn  s     r   !test_missing_lineno_shows_as_none-PEP626Tests.test_missing_lineno_shows_as_none	  sA    	1%ZZ''5T'U
4(r!   c                 L   ^  " S S5      mU4S jnU R                  USS5        g )Nc                        \ rS rSrS rS rSrg)CPEP626Tests.test_lineno_after_raise_in_with_exit.<locals>.ExitFailsi	  c                     U $ r   r(   r5   s    r   r  MPEP626Tests.test_lineno_after_raise_in_with_exit.<locals>.ExitFails.__enter__	  r  r!   c                     [         er   r  r  s     r   r  LPEP626Tests.test_lineno_after_raise_in_with_exit.<locals>.ExitFails.__exit__	  s      r!   r(   Nr  r(   r!   r   	ExitFailsrR  	  s    !r!   rW  c                  R   > T " 5          SS-    S S S 5        g ! , (       d  f       g = fr  r(   )rW  s   r   rE  DPEP626Tests.test_lineno_after_raise_in_with_exit.<locals>.after_with	  s    ! s   
&r[   r  )r   rE  rW  s     @r   $test_lineno_after_raise_in_with_exit0PEP626Tests.test_lineno_after_raise_in_with_exit	  s&    	! 	!	 	
Aq1r!   r(   N)r#   r$   r%   r&   r  r  r  r!  r'  r-  r3  r:  rG  rN  rZ  r'   r(   r!   r   r  r  	  s9    1$+.14+66
/)
2r!   r  __main__)3r  r  rl   r   r3  r  r   codecsr   	itertoolsr   textwrapr   test.supportr   r   r   r	   r
   r   r   r   test.support.import_helperr   test.support.os_helperr   r   test.support.warnings_helperr   r  r   r   r   rQ   r4   r   r*   r0   TestCaser9   rS  rr  r  r  r  force_not_colorized_test_classr  r  r  r#   r  r(   r!   r   <module>rf     sg    	 
       / / /
 5 1 7 !Y I 
+ +d.X&& d.N9-(X&& -(d&+(++ &+VJ6x(( J6Z,CD(++ CDL 	''sCx(( sC (sCl("3"3 k2(## k2Z zMMO SO  IGs   
E 
E*)E*