a
    zeA                     @   s   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	m
Z
mZmZmZmZmZmZmZmZmZ d dlmZ G dd deZG dd deZG dd	 d	eZG d
d dejZG dd dejZedkre  dS )    N)TESTFNcaptured_stderrcheck_impl_detailcheck_warningscpython_only
gc_collect
no_tracingunlinkimport_modulescript_helperSuppressCrashReport)supportc                   @   s   e Zd Zdd ZdS )NaiveExceptionc                 C   s
   || _ d S Nxselfr    r   */usr/lib/python3.9/test/test_exceptions.py__init__   s    zNaiveException.__init__N__name__
__module____qualname__r   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZdd ZdS )SlottedNaiveExceptionr   c                 C   s
   || _ d S r   r   r   r   r   r   r      s    zSlottedNaiveException.__init__N)r   r   r   	__slots__r   r   r   r   r   r      s   r   c                   @   s   e Zd Zdd ZdS )BrokenStrExceptionc                 C   s   t dd S )Nzstr() is broken)	Exceptionr   r   r   r   __str__   s    zBrokenStrException.__str__N)r   r   r   r    r   r   r   r   r      s   r   c                   @   sL  e Zd Zdd Zdd Zdd Zdd Zdd
dZdd Zdd Z	e
dd Zdd Zeejdkddd Zdd Zdd Zdd Zdd Zd d! Zd"d# Zd$d% Zd&d' Zed(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zd2d3 Z d4d5 Z!d6d7 Z"d8d9 Z#d:d; Z$d<d= Z%d>d? Z&d@dA Z'dBdC Z(dDdE Z)dFdG Z*dHdI Z+dJdK Z,dLdM Z-dNdO Z.dPdQ Z/dRdS Z0dTdU Z1dVdW Z2dXdY Z3edZd[ Z4e
d\d] Z5e
d^d_ Z6e
d`da Z7dbdc Z8e
ddde Z9e
dfdg Z:e
dhdi Z;e
djdk Z<edldm Z=dndo Z>dpdq Z?drds Z@e
dtdu ZAdvdw ZBdxdy ZCdzd{ ZDed|d}d~d ZEdd ZFdS )ExceptionTestsc                 C   s   | j ||d z|dW n, |yH } zt|}W Y d }~n
d }~0 0 z|dW n, |y } zt|}W Y d }~n
d }~0 0 | || | |j| W d    n1 s0    Y  d S )N)excexcnameZspam)subTeststrassertEqualr   )r   r"   r#   errZbuf1Zbuf2r   r   r   raise_catch$   s    zExceptionTests.raise_catchc              
   C   s  |  td | tttd |  td ttd}|  ttd}tj	}zDzdd l
}|d W n tyt   Y n0 W |t_	|  tt n|t_	|  tt 0 |  td | ttd	d |  td
 | ttd |  td g }| t|jd |  td i }| t|jd |  td |  td |  td zt}W n ty^   Y n0 |  td d}tdD ]}||7 }qx|  td |  td |  td ztd W n ty   Y n0 |  td |  td ztddd W n ty
   Y n0 |  d |  t!d  |  t"d! | t"tj#d |  t$d" zg d#  W n t$yj   Y n0 |  t%d$ | t%t&d% |  t'd& zdd }W n t'y   Y n0 |  t(d' zdd }W n& t(y } zW Y d }~n
d }~0 0 |  t)d( d S ))NAttributeErrorZundefined_attributeEOFErrorwrr       OSErrorzthis file does not existImportErrorZundefined_module
IndexError
   KeyErrorkeyKeyboardInterruptMemoryError	NameErrorOverflowError      RuntimeErrorRecursionErrorSyntaxErrorz/
IndentationErrorTabErrorz"try:
	1/0
    	1/0
finally:
 pass
z<string>execzTabError not raisedSystemError
SystemExit	TypeErrorr   
ValueErrori   ZeroDivisionErrorr   StopAsyncIteration)*r(   r)   assertRaisesgetattrsysr*   openr   closestdinmarshalloadsr	   r.   r/   
__import__r0   __getitem__r2   r4   r5   r6   Zundefined_variabler7   ranger:   r;   r<   r?   r=   r>   compilefailr@   rA   exitrB   rC   chrrD   r   rE   )r   fpZ	savestdinrL   r   dummyer   r   r   testRaising1   s    





&zExceptionTests.testRaisingc                    s(    fdd}d}||d |dd d S )Nc                    s    j | |dn zt| dd W nB tyb } z*|j|krN d||jf  W Y d }~nd }~0 0  d W d    n1 s0    Y  d S )N)srcmsg
<fragment>r?   expected %s, got %s"failed to get expected SyntaxError)r$   rQ   r<   rZ   rR   )rY   rZ   rW   r   r   r   ckmsg   s    
*z4ExceptionTests.testSyntaxErrorMessage.<locals>.ckmsgzHif 1:
        try:
            continue
        except:
            passz'continue' not properly in loopz	continue
r   r   r^   sr   r   r   testSyntaxErrorMessage   s    

z%ExceptionTests.testSyntaxErrorMessagec                    s^   t f fdd	}d}||d d}||d d}||d d	}||d
t d}||dt d S )Nc              
      sb   zt | dd W nB |yR } z*|j|kr> d||jf  W Y d }~nd }~0 0  d d S )Nr[   r?   r\   r]   )rQ   rZ   rR   )rY   rZ   	exceptionrW   r   r   r   r^      s    
*z:ExceptionTests.testSyntaxErrorMissingParens.<locals>.ckmsgzprint "old style"zHMissing parentheses in call to 'print'. Did you mean print("old style")?zprint "old style",zQMissing parentheses in call to 'print'. Did you mean print("old style", end=" ")?zexec "old style"z%Missing parentheses in call to 'exec'zif True:
print "No indent"zexpected an indented blockz6if True:
        print()
	exec "mixed tabs and spaces"z2inconsistent use of tabs and spaces in indentation)r<   r=   r>   r_   r   r   r   testSyntaxErrorMissingParens   s    	


z+ExceptionTests.testSyntaxErrorMissingParensutf-8c              	   C   s   | j |||d | t}t|dd W d    n1 s>0    Y  | |jj| | |jj| |jjd urt	|t
s||d}|d|d  }| ||jj W d    n1 s0    Y  d S )N)sourcelinenooffsetr[   r?   replace
r8   )r$   rF   r<   rQ   r&   rb   rf   rg   text
isinstancer%   decodesplitassertIn)r   rY   rf   rg   encodingcmliner   r   r   check   s    *
zExceptionTests.checkc                 C   s   | j }|ddd d S )Nz"\
"(1 for c in I,\
\      )rr   r   rr   r   r   r   )test_error_offset_continuation_characters   s    z8ExceptionTests.test_error_offset_continuation_charactersc                 C   s@  | j }|ddd |ddd |ddd |d	dd
 |ddd
 |ddddd |ddd |ddd |ddd |ddd |ddd |ddd |ddd |ddd |ddd |ddd |ddd |ddd  |d!dd |d"dd |d#dd |d$ddd%d |d&d'd
 |d(dd |d)dd |d*d+t rNd+nd, |d-dd. |d/dd |d0dd |d1dd |d2dd |d3dd |d4dd |d5dd |d6dd |d7dd |d8dd. |d9dd |d:dd |d;dd. |d<dt rdnd |d=dt r*dnd  |d>dd. d S )?Nzdef fact(x):
	return x!
   r1   z1 +
r8      z def spam():
  print(1)
 print(2)rs   zPython = "Python" +   u   Python = "Ṕýţĥòñ" +s+   # -*- coding: cp1251 -*-
Python = "ϳ" +   cp1251)ro   s   Python = "ϳ" +   zx = "a   zlambda x: x = 2zf{a + b + c}zclass foo:return 1   zdef f():
  continuezdef f():
  breakz4try:
  pass
except:
  pass
except ValueError:
  passz(0x+1)zx = 0xI   z0010 + 2z
x = 32e-+4   z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+)s   ﻿#coding: utf8
print('我')
r   z!x = [(yield i) for i in range(3)]   zdef f():
  from _ import *zdef f(x, x):
  passz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(yield i) = 2zdef f(*):
  passzfor 1 in []: pass)rr   r   Zuse_old_parserru   r   r   r   testSyntaxErrorOffset   sh    	
z$ExceptionTests.testSyntaxErrorOffsetc                    sj   G dd dt  G dd d fdd} fdd}fd	d
}tjdsf|  |  |  d S )Nc                   @   s   e Zd Zdd ZdS )z9ExceptionTests.testSettingException.<locals>.BadExceptionc                 S   s   t dd S )Nzcan't instantiate BadException)r:   )Zself_r   r   r   r     s    zBExceptionTests.testSettingException.<locals>.BadException.__init__Nr   r   r   r   r   BadException  s   r   c                   @   s   e Zd ZdS )z=ExceptionTests.testSettingException.<locals>.InvalidExceptionNr   r   r   r   r   r   r   InvalidException  s   r   c               
      s   dd l } z|  d W nZ tyr } zBt \}}}|jj}|jd 	|j
d W Y d }~nd }~0 0 d d S )Nr   r8   
test_capi1test_exceptions.pyExpected exception)	_testcapiraise_exceptionrB   rH   exc_infotb_framef_coder&   co_name
assertTrueco_filenameendswithrR   )r   r'   r"   tbcor   r   r   r   r     s    (z7ExceptionTests.testSettingException.<locals>.test_capi1c               
      s   dd l } z|  d W nr ty } zZt \}}}|jj}|jd 	|j
d |jjj}|jd W Y d }~nd }~0 0 d d S )Nr   r   r   
test_capi2r   )r   r   r:   rH   r   r   r   r&   r   r   r   r   f_backrR   )r   r'   r"   r   r   Zco2r   r   r   r   "  s    
$z7ExceptionTests.testSettingException.<locals>.test_capi2c                     s   dd l } t| j d d S )Nr   r8   )r   rF   r@   r   )r   )r   r   r   r   
test_capi30  s    
z7ExceptionTests.testSettingException.<locals>.test_capi3java)r   rH   platform
startswith)r   r   r   r   r   )r   r   r   r   testSettingException
  s    z#ExceptionTests.testSettingExceptionc                 C   s  zt  W n ty   Y n0 | t t | ttdd | ttddd tddd}| |jd | |jd  | t|d td	ddd
}| |jd | |jd
 | |jd | |j	d | |j
d  | t|d td	dd d}| |jd | |jd | |jd | |j	d  | |j
d  | t|d tdd}| |jd | |jd  | |jd | |j	d  | |j
d  d S )Ni  Z1001messagez[Errno 1001] messager   foobarz[Errno 9] foo: 'bar'r   rs   rw   z[WinError 3] foo: 'bar'rt   z[WinError 1001] foo)WindowsErrorr6   assertIsr.   r&   r%   errnowinerrorstrerrorfilename	filename2)r   r+   r   r   r   test_WindowsError:  sB    
z ExceptionTests.test_WindowsErrorwin32ztest specific to Windowsc                 C   sL   t d}d}| td|  |j| W d   n1 s>0    Y  dS )z:Should fill in unknown error code in Windows error messagectypesl   cs@ zWindows Error 0x%xN)r
   assertRaisesRegexr.   Z	pythonapiZPyErr_SetFromWindowsErr)r   r   coder   r   r   test_windows_messagea  s    z#ExceptionTests.test_windows_messagec                 C   s
  t dddift dddift dddift dddiftddddftddd d d d dftd	d	d d dd
dftdd	dd dd
dftdd	dddftddddddftdddddd dftdd d d d d d dftddd d dd d d dftddd dd ddd!d"ftd#d d#d dd d d d$ftdddiftd%d%d&d'd(d)d*ftd&td+d(dd)fd&td+d(dd)fd&d+d(d)d*ftd,d,d&d+d(d)d*ftd-d-d.d/d(dd0ft	dddd1ft
dddd1fg}z"|tdddd ddd d2f W n ty   Y n0 |D ] \}}}z|| }W n$   td3||f tjd4  Y n0 t|jd5sD| t|jd6 t|}|D ]:}t||}| t|t|| d7||||| f  qPtfD ]n}	t|	jd D ]X}
|	||
}|	|}|D ]6}tt||}t|| }| ||d8||f  qqqqd S )9Nr   args)r8   )r   )r   r8   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   )r8   r   r   )r8   r   r8   )r   r   r   r   r   )rZ   rj   r   rf   rg   print_file_and_line)msgStrr   )r   rj   r   rZ   r   rf   rg   )r   )r   	linenoStr	offsetStrtextStrr   r   r   )rg   rj   r   r   rZ   r   rf   )r   r   r   r   r   Zprint_file_and_lineStr)rj   r   r   rZ   r   rf   rg   )asciiar   r8   ordinal not in ranger   r   r   r   )r   ro   objectstartreason   )r   r   r   r8   r   )   あr   r8   ouchr   r   )r   r   r   r   end)r   r   )r   r   r   r   r   r   z
exc=%r, args=%r)filer   builtinsz%r.%s == %r, expected %rzpickled "%r", attribute "%s)BaseExceptionrA   r.   r<   UnicodeErrorUnicodeEncodeErrorUnicodeDecodeError	bytearrayUnicodeTranslateErrorr   r   appendr   r6   printrH   stderrtyper   r   r&   r   r%   rG   reprpicklerP   HIGHEST_PROTOCOLdumpsrM   )r   ZexceptionListr"   r   ZexpectedrW   r`   ZcheckArgNamevaluepprotocolnewZgotZwantr   r   r   testAttributesk  s"   
O




zExceptionTests.testAttributesc                 C   s   zt dW n   t d }Y n0 t |}| |t | |j| t d|}| |t  | |j| G dd dt}| |}| || | |j| d S )Nrx   rw   r   c                   @   s   e Zd ZdS )z5ExceptionTests.testWithTraceback.<locals>.MyExceptionNr   r   r   r   r   MyException  s   r   )	r0   rH   r   r   with_tracebackassertIsInstancer&   __traceback__r   )r   r   rW   r   r   r   r   testWithTraceback  s    z ExceptionTests.testWithTracebackc              
   C   sP   zdt  _W n4 ty@ } z| dt| W Y d }~nd }~0 0 | d d S )Nr   z!__traceback__ must be a tracebackzNo exception raised)r   r   rB   rn   r%   rR   r   rW   r   r   r   testInvalidTraceback  s
    &z#ExceptionTests.testInvalidTracebackc                 C   sP   |  ttt dd |  ttt d |  ttt dd |  ttt d d S )N	__cause__r8   __context__)rF   rB   setattrr   delattrr   r   r   r   testInvalidAttrs  s    zExceptionTests.testInvalidAttrsc                 C   sJ   zt dW n   t d }Y n0 t }||_d |_| |jd  d S )Nrx   rw   )r0   rH   r   r   r   r&   )r   r   rW   r   r   r   testNoneClearsTracebackAttr  s    z*ExceptionTests.testNoneClearsTracebackAttrc                 C   sn   t  }| |j | |j t }| |j | |j G dd dt}| }| |j | |j d S )Nc                   @   s   e Zd ZdS )z5ExceptionTests.testChainingAttrs.<locals>.MyExceptionNr   r   r   r   r   r      s   r   )r   assertIsNoner   r   rB   r.   )r   rW   r   r   r   r   testChainingAttrs  s    z ExceptionTests.testChainingAttrsc              
   C   s   z
t  W n( t y2 } z|}W Y d }~n
d }~0 0 | |j | |j | |j t |_d |_| |jt | |j | |j d|_| |j d S )NF)	r   r   r   r   ZassertFalse__suppress_context__r6   r   r   )r   r"   rW   r   r   r   testChainingDescriptors'  s    
z&ExceptionTests.testChainingDescriptorsc                 C   s<   | j ttdd G dd dt}|dd}| |jd d S )Nr8   )r   c                   @   s   e Zd Zdd ZdS )z8ExceptionTests.testKeywordArgs.<locals>.DerivedExceptionc                 S   s   t |  || _d S r   )r   r   	fancy_arg)r   r   r   r   r   r   ?  s    
zAExceptionTests.testKeywordArgs.<locals>.DerivedException.__init__Nr   r   r   r   r   DerivedException>  s   r   *   )r   )rF   rB   r   r&   r   )r   r   r   r   r   r   testKeywordArgs9  s    
zExceptionTests.testKeywordArgsc                    s4    fdd |  t  fdd|  t d S )Nc                      s     S r   r   r   )fr   r   r   H  s    z/ExceptionTests.testInfiniteRecursion.<locals>.fc                      s"   z  W S  t y   Y dS 0 d S )Nr   rC   r   gr   r   r   L  s    z/ExceptionTests.testInfiniteRecursion.<locals>.g)rF   r;   r   r   )r   r   r   testInfiniteRecursionF  s    z$ExceptionTests.testInfiniteRecursionc                 C   s8   |  tt |  ttd |  ttdd d S )Nr   b)r   r%   r   r   r   r   r   test_strS  s    zExceptionTests.test_strc              
   C   s|   z
t  W n0 t y: } z| |t  W Y d }~n
d }~0 0 | dt  | t | W d    n1 sn0    Y  d S NrW   r   r   ZassertNotInlocalsrF   UnboundLocalErrorr   r   r   r   test_exception_cleanup_namesY  s    
"z+ExceptionTests.test_exception_cleanup_namesc              
   C   s~   z
t  W n2 t y< } z| |t  ~W Y d }~n
d }~0 0 | dt  | t | W d    n1 sp0    Y  d S r   r   r   r   r   r   test_exception_cleanup_names2d  s    
z,ExceptionTests.test_exception_cleanup_names2c                    s  G dd dt  G dd d} fdd}| t}z
|  W n$  yj } zW Y d }~n
d }~0 0 d t  | |  | t}z
|  W n  y   Y n0 d t  | |  | t}z
|  W n   Y n0 d t  | |  | t}dD ]&}z
|  W n   Y  qLY n0 q$d t  | |  | t}z z
|  W n   tY n0 W nX ty } z>d |_d t  | tdd	rt  |  W Y d }~n
d }~0 0 | t}z
|  W n<  yF   zz W  n 0 W n  y@   Y n0 Y n0 d tdd	r^t  | |  G d
d d}| t}|  |  W d    n1 s0    Y  d tdd	rt  | |  d S )Nc                   @   s   e Zd Zdd ZdS )z=ExceptionTests.testExceptionCleanupState.<locals>.MyExceptionc                 S   s
   || _ d S r   objr   r   r   r   r   r   t  s    zFExceptionTests.testExceptionCleanupState.<locals>.MyException.__init__Nr   r   r   r   r   r   s  s   r   c                   @   s   e Zd ZdS )z7ExceptionTests.testExceptionCleanupState.<locals>.MyObjNr   r   r   r   r   MyObjv  s   r   c                     s   }  d S r   r   )Z	local_refr   r   r   r   inner_raising_funcy  s    zDExceptionTests.testExceptionCleanupState.<locals>.inner_raising_func)r   F)Zcpythonc                   @   s   e Zd Zdd Zdd ZdS )z9ExceptionTests.testExceptionCleanupState.<locals>.Contextc                 S   s   | S r   r   r   r   r   r   	__enter__  s    zCExceptionTests.testExceptionCleanupState.<locals>.Context.__enter__c                 S   s   dS )NTr   )r   exc_type	exc_valueexc_tbr   r   r   __exit__  s    zBExceptionTests.testExceptionCleanupState.<locals>.Context.__exit__N)r   r   r   r   r  r   r   r   r   Context  s   r  )r   weakrefrefr   r   r2   r   r   )r   r   r   wrrW   ir  r   r   r   testExceptionCleanupStateo  s    













 



&z(ExceptionTests.testExceptionCleanupStatec              
      sD    fdd}zt  W n* ty>   z|  W Y d   n
d   0 0 d S )Nc                      s     d S r   r   r   rW   r   r   print_error  s    zIExceptionTests.test_exception_target_in_nested_scope.<locals>.print_error)Z	somethingr   )r   r  r   r  r   %test_exception_target_in_nested_scope  s
    z4ExceptionTests.test_exception_target_in_nested_scopec                 C   s   dd }| }|  t|t |  t d d  |  t|t |  t d d  |  t|d  ztdW n ty   | }|  t|t |  t d t |  t|t |  t d t |  t|t ~|  t d t Y n0 d S )Nc                   s   sN   zt dW n. t y:   t d V  t d V  Y n0 t d V  d S )NZcaughtr   )r2   rH   r   r   r   r   r   yield_raise  s    z:ExceptionTests.test_generator_leaking.<locals>.yield_raiser   r   )r&   nextr2   rH   r   rB   )r   r  r   r   r   r   test_generator_leaking  s$    z%ExceptionTests.test_generator_leakingc                 C   sf   dd }zt W n  t y0   | }t| Y n0 zt| W n tyP   Y n0 | t d d S )Nc                   s   s
   d V  d S r   r   r   r   r   r   r     s    z1ExceptionTests.test_generator_leaking2.<locals>.gNNN)r:   r  StopIterationr&   rH   r   r   r   itr   r   r   test_generator_leaking2  s    z&ExceptionTests.test_generator_leaking2c              
   C   s   dd }| }t | zdd  W nb ty } zJ| t d | ||}| t d | | || W Y d }~n
d }~0 0 | t d d S )Nc                   s   s0   z
d V  W n  t y*   t d V  Y n0 d S Nr8   rD   rH   r   r   r   r   r   r   #  s    
z1ExceptionTests.test_generator_leaking3.<locals>.gr8   r   r  )r  rD   r   rH   r   throwr&   )r   r   r  rW   Zgen_excr   r   r   test_generator_leaking3   s    
"z&ExceptionTests.test_generator_leaking3c              
   C   s   dd }| }zt W n t y0   t|}Y n0 | |t zt| W n8 ty } z | t d | W Y d }~n
d }~0 0 | t d d S )Nc                   s   s4   zdd  W n" t y.   t d V   Y n0 d S Nr8   r   r  r   r   r   r   r   6  s
    z1ExceptionTests.test_generator_leaking4.<locals>.gr8   r  )rB   r  r   rD   rH   r   r&   )r   r   r  tprW   r   r   r   test_generator_leaking43  s    *z&ExceptionTests.test_generator_leaking4c                    sH    fdd}| }zt W n t y4   t| Y n0  tt| d S )Nc                   3   s.     t d t d V   t d d S )Nr8   r  )r   rH   r   r:   r&   r   r   r   r   r   O  s    z>ExceptionTests.test_generator_doesnt_retain_old_exc.<locals>.g)r:   r  rF   r  r  r   r   r   $test_generator_doesnt_retain_old_excN  s    z3ExceptionTests.test_generator_doesnt_retain_old_excc                    s4   dd   fdd}|  t   | t d d S )Nc                   s   s
   dV  d S r  r   r   r   r   r   
simple_gen\  s    zIExceptionTests.test_generator_finalizing_and_exc_info.<locals>.simple_genc                     s.     } zt W n t y(   t|  Y S 0 d S r   )r:   r  )genr  r   r   run_gen^  s
    zFExceptionTests.test_generator_finalizing_and_exc_info.<locals>.run_genr  )r   r&   rH   r   )r   r!  r   r   r   &test_generator_finalizing_and_exc_infoZ  s
    z5ExceptionTests.test_generator_finalizing_and_exc_infoc                    st   G dd dt  G dd d} fdd}| t}| }t| || d  }t  | |  d S )Nc                   @   s   e Zd Zdd ZdS )zFExceptionTests._check_generator_cleanup_exc_state.<locals>.MyExceptionc                 S   s
   || _ d S r   r   r   r   r   r   r   l  s    zOExceptionTests._check_generator_cleanup_exc_state.<locals>.MyException.__init__Nr   r   r   r   r   r   k  s   r   c                   @   s   e Zd ZdS )z@ExceptionTests._check_generator_cleanup_exc_state.<locals>.MyObjNr   r   r   r   r   r   n  s   r   c                   3   s*   z W n  y$   d V  Y n0 d S r   r   r   r   r   r   raising_genq  s    zFExceptionTests._check_generator_cleanup_exc_state.<locals>.raising_gen)r   r  r  r  r   r   )r   Ztestfuncr   r#  r  r   r   r   r   "_check_generator_cleanup_exc_stateh  s    
z1ExceptionTests._check_generator_cleanup_exc_statec                 C   s   dd }|  | d S )Nc                 S   s(   z|  t  W n ty"   Y n0 d S r   )r  r:   r   r   r   r   do_throw  s    zGExceptionTests.test_generator_throw_cleanup_exc_state.<locals>.do_throwr$  )r   r%  r   r   r   &test_generator_throw_cleanup_exc_state  s    z5ExceptionTests.test_generator_throw_cleanup_exc_statec                 C   s   dd }|  | d S )Nc                 S   s   |    d S r   )rJ   r   r   r   r   do_close  s    zGExceptionTests.test_generator_close_cleanup_exc_state.<locals>.do_closer&  )r   r(  r   r   r   &test_generator_close_cleanup_exc_state  s    z5ExceptionTests.test_generator_close_cleanup_exc_statec                 C   s   dd }|  | d S )Nc                 S   s   d } d S r   r   r   r   r   r   do_del  s    zCExceptionTests.test_generator_del_cleanup_exc_state.<locals>.do_delr&  )r   r*  r   r   r   $test_generator_del_cleanup_exc_state  s    z3ExceptionTests.test_generator_del_cleanup_exc_statec                    s    fdd}  | d S )Nc                    s.   zt |  W n ty   Y n0  d d S Nz should have raised StopIteration)r  r  rR   r   r   r   r   do_next  s
    zEExceptionTests.test_generator_next_cleanup_exc_state.<locals>.do_nextr&  )r   r-  r   r   r   %test_generator_next_cleanup_exc_state  s    z4ExceptionTests.test_generator_next_cleanup_exc_statec                    s    fdd}  | d S )Nc                    s0   z|  d  W n ty    Y n0  d d S r,  )sendr  rR   r   r   r   r   do_send  s
    zEExceptionTests.test_generator_send_cleanup_exc_state.<locals>.do_sendr&  )r   r0  r   r   r   %test_generator_send_cleanup_exc_state  s    z4ExceptionTests.test_generator_send_cleanup_exc_statec                    sH   G  fddd}d zt | W n   Y n0 t  |  d d S )Nc                       s   e Zd Z fddZdS )z*ExceptionTests.test_3114.<locals>.MyObjectc                    s   t   d S r   )rH   r   r   r  r   r   __del__  s    z2ExceptionTests.test_3114.<locals>.MyObject.__del__Nr   r   r   r2  r   r  r   r   MyObject  s   r4  r   r  )r   r   r&   )r   r4  r   r  r   	test_3114  s    zExceptionTests.test_3114c                 C   s  G dd dt }G dd dt }G dd dt }zz|W n |y } z|}z|W n |y } z|}z|W nx |y } z`|}	| || | || | |	| | |j | |j| | |	j| |W Y d }~n
d }~0 0 W Y d }~n
d }~0 0 W Y d }~n
d }~0 0 W n* |yH }
 z|
}W Y d }
~
n
d }
~
0 0 | || | |j|	 | |	j| | |j d S )Nc                   @   s   e Zd ZdS )zHExceptionTests.test_raise_does_not_create_context_chain_cycle.<locals>.ANr   r   r   r   r   A  s   r6  c                   @   s   e Zd ZdS )zHExceptionTests.test_raise_does_not_create_context_chain_cycle.<locals>.BNr   r   r   r   r   B  s   r7  c                   @   s   e Zd ZdS )zHExceptionTests.test_raise_does_not_create_context_chain_cycle.<locals>.CNr   r   r   r   r   C  s   r8  )r   r   r   r   r   )r   r6  r7  r8  Za_r   Zb_r   Zc_crW   r"   r   r   r   .test_raise_does_not_create_context_chain_cycle  s:    Jz=ExceptionTests.test_raise_does_not_create_context_chain_cyclec              
   C   sl   dd }z
|  W n( t y: } z|}W Y d }~n
d }~0 0 | |t | |jt | |jj|j d S )Nc               
   S   sD   zt dW n2 t y> }  z| | _tdW Y d } ~ n
d } ~ 0 0 d S Nr8   rw   )rC   r   rB   )exr   r   r   cycle  s
    zBExceptionTests.test_no_hang_on_context_chain_cycle1.<locals>.cycle)r   r   rB   r   rC   r   )r   r=  rW   r"   r   r   r   $test_no_hang_on_context_chain_cycle1  s    
z3ExceptionTests.test_no_hang_on_context_chain_cycle1c                 C   s<  G dd dt }G dd dt }G dd dt }| |}z
| W n |y } z|}z
| W nf |y } zN|}z
| W n2 |y }	 z|	}
|
|_|
W Y d }	~	n
d }	~	0 0 W Y d }~n
d }~0 0 W Y d }~n
d }~0 0 W d    n1 s0    Y  | |j|
 | |
j| | |j| | |j|
 d S )Nc                   @   s   e Zd ZdS )z>ExceptionTests.test_no_hang_on_context_chain_cycle2.<locals>.ANr   r   r   r   r   r6    s   r6  c                   @   s   e Zd ZdS )z>ExceptionTests.test_no_hang_on_context_chain_cycle2.<locals>.BNr   r   r   r   r   r7    s   r7  c                   @   s   e Zd ZdS )z>ExceptionTests.test_no_hang_on_context_chain_cycle2.<locals>.CNr   r   r   r   r   r8    s   r8  r   rF   r   r   rb   )r   r6  r7  r8  rp   _ar   _br   _cr9  r   r   r   $test_no_hang_on_context_chain_cycle2  s,    


dz3ExceptionTests.test_no_hang_on_context_chain_cycle2c                 C   s  G dd dt }G dd dt }G dd dt }G dd dt }G d	d
 d
t }| |}z
| W n |y@ } z|}z
| W n |y* }	 z|	}
z
| W nn |y } zT|}||_z
| W n2 |y } z|}| }|W Y d }~n
d }~0 0 W Y d }~n
d }~0 0 W Y d }	~	n
d }	~	0 0 W Y d }~n
d }~0 0 W d    n1 sX0    Y  | |j| | |j| | |j| | |j|
 | |
j| | |j| d S )Nc                   @   s   e Zd ZdS )z>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.ANr   r   r   r   r   r6    s   r6  c                   @   s   e Zd ZdS )z>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.BNr   r   r   r   r   r7    s   r7  c                   @   s   e Zd ZdS )z>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.CNr   r   r   r   r   r8    s   r8  c                   @   s   e Zd ZdS )z>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.DNr   r   r   r   r   D  s   rD  c                   @   s   e Zd ZdS )z>ExceptionTests.test_no_hang_on_context_chain_cycle3.<locals>.ENr   r   r   r   r   E   s   rE  r?  )r   r6  r7  r8  rD  rE  rp   r@  r   rA  r   rB  r9  Z_ddrW   r   r   r   $test_no_hang_on_context_chain_cycle3  s>    



|z3ExceptionTests.test_no_hang_on_context_chain_cycle3c                 C   sf  t ddddd}| t|d d|_| t|d d|_d	|_| t|d
 d|_| t|d d|_| t|d tddddd}| t|d d|_| t|d d|_d	|_| t|d d|_| t|d d|_| t|d tdddd}| t|d d|_| t|d d|_d	|_| t|d d|_| t|d d S )Nr   Zxxxxxr8   r   r   z8'baz' codec can't encode characters in position 1-4: foorw   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: 965230951443685724997Z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   r&   r%   r   r   ro   r   r   r   )r   ur   r   r   test_unicode_change_attributesD  s>    z-ExceptionTests.test_unicode_change_attributesc                 C   s.   t ttf}|D ]}| t||d qd S )N )r   r   r   r&   r%   __new__)r   Zklassesklassr   r   r   test_unicode_errors_no_objecti  s    
z,ExceptionTests.test_unicode_errors_no_objectc                    s   G dd dt }G dd dt|d}t x}z
t W nR |yd } z| d W Y d }~n8d }~0  tyt   Y n    | d Y n0 | d W d    n1 s0    Y   fdd	   \}}}| |tt | | d
t| d S )Nc                   @   s   e Zd Zdd ZdS )z/ExceptionTests.test_badisinstance.<locals>.Metac                 S   s
   t  d S r   r   )clssubclassr   r   r   __subclasscheck__t  s    zAExceptionTests.test_badisinstance.<locals>.Meta.__subclasscheck__N)r   r   r   rP  r   r   r   r   Metas  s   rQ  c                   @   s   e Zd ZdS )z6ExceptionTests.test_badisinstance.<locals>.MyExceptionNr   r   r   r   r   r   v  s   r   )	metaclassz%exception should not be a MyExceptionzShould have raised KeyErrorc                      s(   z  W S  t y"   t  Y S 0 d S r   )r;   rH   r   r   r   r   r   r     s    z,ExceptionTests.test_badisinstance.<locals>.gz maximum recursion depth exceeded)	r   r   r   r2   rR   r   r;   rn   r%   )r   rQ  r   r   rW   vr   r   r   r   test_badisinstanceo  s     
(z!ExceptionTests.test_badisinstancec                 C   s   dd }|  t   d S )Nc                  S   s   t  } tdD ]
}| j} qd S )Ni@B )r   rP   __dir__)or   r   r   r   r     s    z3ExceptionTests.test_trashcan_recursion.<locals>.foo)r   r   )r   r   r   r   r   test_trashcan_recursion  s    z&ExceptionTests.test_trashcan_recursionc                 C   sP   dt  }tdd|\}}}| |d | d| | d| | d| d S )Na  if 1:
            import sys
            from _testinternalcapi import get_recursion_depth

            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()
            depth = get_recursion_depth()
            try:
                # Upon the last recursive invocation of recurse(),
                # tstate->recursion_depth is equal to (recursion_limit - 1)
                # and is equal to recursion_limit when _gen_throw() calls
                # PyErr_NormalizeException().
                recurse(setrecursionlimit(depth + 2) - depth)
            finally:
                sys.setrecursionlimit(recursionlimit)
                print('Done.')
        z-Wd-cr8   s   RecursionErrors   ResourceWarning   Done.)__file__r   assert_python_failurer&   rn   r   r   rcoutr'   r   r   r   $test_recursion_normalizing_exception  s    ()z3ExceptionTests.test_recursion_normalizing_exceptionc                 C   s>   d}t d|\}}}| |d | d| | d| d S )Nzif 1:
            import _testcapi
            try:
                raise _testcapi.RecursingInfinitelyError
            finally:
                print('Done.')
        rX  r8   sO   RecursionError: maximum recursion depth exceeded while normalizing an exceptionrY  )r   r[  r&   rn   r\  r   r   r   -test_recursion_normalizing_infinite_exception  s    z<ExceptionTests.test_recursion_normalizing_infinite_exceptionc              
      s   dd }fdd fdd fddt  }zz|d	  fD ]X}| j|d
8 z
|  W n tyv   Y n0 | d W d    qH1 s0    Y  qHW t | nt | 0 d S )Nc                 S   sD   d}zt | W q2 ty,   |d7 }Y q0 q2qt ||   d S r  )rH   setrecursionlimitr;   )ndepthr   r   r   set_relative_recursion_limit  s    zUExceptionTests.test_recursion_in_except_handler.<locals>.set_relative_recursion_limitc                      s$   zdd  W n      Y n0 d S r  r   r   )recurse_in_exceptr   r   re    s    zJExceptionTests.test_recursion_in_except_handler.<locals>.recurse_in_exceptc                      s$   zdd  W n   Y n0    d S r  r   r   )recurse_after_exceptr   r   rf    s
    zMExceptionTests.test_recursion_in_except_handler.<locals>.recurse_after_exceptc                      s"   z
   W n      Y n0 d S r   r   r   )recurse_in_body_and_exceptr   r   rg    s    
zSExceptionTests.test_recursion_in_except_handler.<locals>.recurse_in_body_and_exceptr1   )funcz#Should have raised a RecursionError)rH   getrecursionlimitr$   r;   rR   ra  )r   rd  Zrecursionlimitrh  r   )rf  rg  re  r    test_recursion_in_except_handler  s    
,z/ExceptionTests.test_recursion_in_except_handlerc                 C   sL   d}t  . td|\}}}| d| W d    n1 s>0    Y  d S )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)
        rX  sm   Fatal Python error: _PyErr_NormalizeException: Cannot recover from MemoryErrors while normalizing exceptions.)r   r   r[  rn   r\  r   r   r   )test_recursion_normalizing_with_no_memory  s    z8ExceptionTests.test_recursion_normalizing_with_no_memoryc                    s@   dd l ddlm   fdd}| }| }|| d S )Nr   raise_memoryerrorc               
      sJ   z
   W n* t y4 }  z| j}W Y d } ~ nd } ~ 0 0 d |S )Nz Should have raises a MemoryError)r5   r   rR   	format_tb)rW   r   rm  r   	tracebackr   r   raiseMemError6  s    

z6ExceptionTests.test_MemoryError.<locals>.raiseMemError)rp  r   rm  r&   )r   rq  Ztb1Ztb2r   ro  r   test_MemoryError0  s    	zExceptionTests.test_MemoryErrorc           
      C   s"  dd l }d}d}| t|jd |d}| t|t | t|t | 	|j
 |d|}| |j
| |jd|d}| t|| G d	d
 d
t}|d|||f}| t|| | t|| | |j
| |dd|ddi}	| t|	| | |	jd | |	j
d d S )Nr   zThis is a test docstring.zThis is another test docstring.error1z_testcapi.error1z_testcapi.error2z_testcapi.error3)basec                   @   s   e Zd ZdS )z1ExceptionTests.test_exception_with_doc.<locals>.CNr   r   r   r   r   r8  \  s   r8  z_testcapi.error4z_testcapi.error5rJ  r   r8   )r   rF   r@   Zmake_exception_with_docr   r   r   
issubclassr   r   __doc__r&   r   r   )
r   r   Zdoc2Zdoc4rs  Zerror2Zerror3r8  Zerror4Zerror5r   r   r   test_exception_with_docC  s:    

z&ExceptionTests.test_exception_with_docc              
      s   ddl m G dd d d  fdd}z
|  W n2 tyj } z|  d  W Y d }~nd }~0 0 | d t  |  d  d S )Nr   rl  c                   @   s   e Zd ZdS )z3ExceptionTests.test_memory_error_cleanup.<locals>.CNr   r   r   r   r   r8  p  s   r8  c                     s     } t |   d S r   r  r  r9  r8  rm  r  r   r   inners  s    
z7ExceptionTests.test_memory_error_cleanup.<locals>.innerzMemoryError not raised)r   rm  r5   assertNotEqualrR   r   r&   )r   r{  rW   r   rz  r   test_memory_error_cleanupk  s    
$
z(ExceptionTests.test_memory_error_cleanupc              
      s   G dd d d  fddz
  W n2 t y^ } z|  d  W Y d }~nd }~0 0 | d t  |  d  d S )Nc                   @   s   e Zd ZdS )z6ExceptionTests.test_recursion_error_cleanup.<locals>.CNr   r   r   r   r   r8    s   r8  c                     s     } t |   d S r   rx  ry  r8  r{  r  r   r   r{    s    
z:ExceptionTests.test_recursion_error_cleanup.<locals>.innerzRecursionError not raised)r;   r|  rR   r   r&   r   r   r~  r   test_recursion_error_cleanup  s    
$
z+ExceptionTests.test_recursion_error_cleanupc                 C   sN   |  t}tt W d    n1 s*0    Y  | |jjtj|j d S r   )	rF   r.   oslistdirrZ  r&   rb   r   ENOTDIR)r   rp   r   r   r   test_errno_ENOTDIR  s    (z!ExceptionTests.test_errno_ENOTDIRc                 C   sh   G dd d}| }t  8}~t  | |jj|j | |jj W d    n1 sZ0    Y  d S )Nc                   @   s   e Zd Zdd ZdS )z1ExceptionTests.test_unraisable.<locals>.BrokenDelc                 S   s   t d}|d S )Nzdel is brokenr   r   r"   r   r   r   r2    s    z9ExceptionTests.test_unraisable.<locals>.BrokenDel.__del__Nr3  r   r   r   r   	BrokenDel  s   r  )	r   Zcatch_unraisable_exceptionr   r&   Z
unraisabler   r2  ZassertIsNotNoneexc_traceback)r   r  r   rp   r   r   r   test_unraisable  s    
zExceptionTests.test_unraisablec                 C   s   t tfD ]}| | z|d}|W nF |yn   t }tjt   W d    n1 s`0    Y  Y n0 | }| d| | d| | |j	| |tu r| d| n| d| | 
|d W d    q1 s0    Y  qd S )Nztest messager   z	raise excz<exception str() failed>ri   )rC   r   r$   r   rH   __excepthook__r   getvaluern   r   r   r   )r   r  r"   r   reportr   r   r   test_unhandled  s     2zExceptionTests.test_unhandledc                 C   sF   d}t ddD ]2}td|| \}}}| |d | d| qd S )Nzif 1:
            import _testcapi
            class C(): pass
            _testcapi.set_nomemory(0, %d)
            C()
        r8   ry   rX  )r8   x   s   MemoryError)rP   r   r[  rn   )r   r   r	  r]  r^  r'   r   r   r   "test_memory_error_in_PyErr_PrintEx  s
    
z1ExceptionTests.test_memory_error_in_PyErr_PrintExc                    sx   G dd dt  G dd dt  fdd}| }|d  |   |  W d    n1 sj0    Y  d S )Nc                   @   s   e Zd ZdS )zBExceptionTests.test_yield_in_nested_try_excepts.<locals>.MainErrorNr   r   r   r   r   	MainError  s   r  c                   @   s   e Zd ZdS )zAExceptionTests.test_yield_in_nested_try_excepts.<locals>.SubErrorNr   r   r   r   r   SubError  s   r  c                   3   sB   z
  W n2  y<   z
d V  W n y4   Y n0  Y n0 d S r   r   r   r  r  r   r   main  s    

z=ExceptionTests.test_yield_in_nested_try_excepts.<locals>.main)r   r/  rF   r  )r   r  coror   r  r    test_yield_in_nested_try_excepts  s    

z/ExceptionTests.test_yield_in_nested_try_exceptsc                    sR    fdd}| }zt W n" t y<    t|d Y n0  t|d d S )Nc                   3   s<   zt W n t y    dV  Y n0  t d dV  d S )Nr8   r  rw   )rC   r&   rH   r   r   r   r   r   r     s    z?ExceptionTests.test_generator_doesnt_retain_old_exc2.<locals>.gr8   rw   )r0   r&   r  )r   r   r  r   r   r   %test_generator_doesnt_retain_old_exc2  s    z4ExceptionTests.test_generator_doesnt_retain_old_exc2c                 C   sf   dd }|  t@ | }zdd  W n   t| t| Y n0 W d    n1 sX0    Y  d S )Nc                   s   s   dV   dV  d S r;  r   r   r   r   r   r     s    z1ExceptionTests.test_raise_in_generator.<locals>.gr8   r   )rF   rD   r  )r   r   r	  r   r   r   test_raise_in_generator  s    z&ExceptionTests.test_raise_in_generatorTz Won't work if __debug__ is Falsec              
   C   sh   t azdsJ dW nB tyV } z*b| |t | t|d W Y d }~nd }~0 0 b| d d S )NFZhellor   )rB   AssertionErrorr   r   r&   r%   rR   r   r   r   r   test_assert_shadowing  s    &z$ExceptionTests.test_assert_shadowingc                 C   s   G dd dt }zt W n( t y@ } z|}W Y d }~n
d }~0 0 z|W n ty\   Y n0 tdD ]8}zt W n$ t y } zW Y d }~n
d }~0 0 t  qfd S )Nc                   @   s   e Zd ZdS )zBExceptionTests.test_memory_error_subclasses.<locals>.TestExceptionNr   r   r   r   r   TestException$  s   r  r1   )r5   r   rP   r   )r   r  r"   inst_r   r   r   test_memory_error_subclasses  s    	z+ExceptionTests.test_memory_error_subclassesN)rd   )Gr   r   r   r(   rX   ra   rc   rr   rv   r   r   r   r   unittestZ
skipUnlessrH   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)  r+  r.  r1  r5  r:  r>  rC  rG  rI  rM  rT  rW  r_  r`  rj  rk  rr  rw  r}  r  r  r  r  r  r  r  r  r  r  r   r   r   r   r!   "   s   T
B
/'
~
y

($/%


:
.


'




r!   c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
ImportErrorTestsc                 C   s  t d}| |j | |j t ddd}| |jd | |j t ddd}| |jd | |j t dddd}| |jd | |jd d}| t| t dd	d
 W d    n1 s0    Y  | t| t ddd	d W d    n1 s0    Y  | t| t ddd	d W d    n1 s@0    Y  | t| t d	d
 W d    n1 sx0    Y  | t| t dd	dd W d    n1 s0    Y  d S )NtestZ
somemodulenamesomepathpathsomename)r  r  z8'invalid' is an invalid keyword argument for ImportErrorkeyword)invalidr  )r  r  r  )r  r  T)r  Zanother)r/   r   r  r  r&   r   rB   )r   r"   rZ   r   r   r   test_attributes<  s.    *..*z ImportErrorTests.test_attributesc                 C   s   t dddd}| |jd | |jd | |jd | |jd |  | |jd | |jd  | |jd  | |jd  d S )Nr  r  r  r  r  r  r   )r/   r&   r   rZ   r  r  r   r  r   r   r   test_reset_attributes^  s    z&ImportErrorTests.test_reset_attributesc                 C   sT   t dtfdd0 d}t|}| t|t| W d    n1 sF0    Y  d S )NrJ  T)quiets   abc)r   BytesWarningr/   r&   r%   )r   argr"   r   r   r   test_non_str_argumentl  s    z&ImportErrorTests.test_non_str_argumentc                 C   s   t  t ddt ddt dddfD ]}td	i |}ttjd D ]R}tt||}| |jd | |j	d | |j
|j
 | |j|j qBtjtjfD ]H}||}| |jd | |j	d | |j
|j
 | |j|j qq"d S )
Nr  r  r  r  r  r  r8   r  )r  )dictr/   rP   r   r   rM   r   r&   r   rZ   r  r  copydeepcopy)r   kwargsZorigprotor"   r9  r   r   r   test_copy_pickles  s$    
z!ImportErrorTests.test_copy_pickleN)r   r   r   r  r  r  r  r   r   r   r   r  :  s   "r  __main__)r  gcr  rH   r  r   r  r   Ztest.supportr   r   r   r   r   r   r   r	   r
   r   r   r  r   r   r   r   r   ZTestCaser!   r  r   r  r   r   r   r   <module>   s8   4            $M