Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/test_atexit.cpython-34.pyo

�
g f*�@s�ddlZddlZddlZddlZddlmZdd�Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�ZGdd�dej�Z
Gdd�dej�Zdd�Zedkr�e�ndS)�N)�supportcCstd�dS)N�h1)�print�rr�5/opt/alt/python34/lib64/python3.4/test/test_atexit.pyrsrcCstd�dS)N�h2)rrrrrrsrcCstd�dS)N�h3)rrrrrrsrcOstd||�dS)N�h4)r)�args�kwargsrrrr	sr	cCs
t�dS)N)�	TypeErrorrrrr�raise1sr
cCs
t�dS)N)�SystemErrorrrrr�raise2src@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�GeneralTestcCsHtj|_tj|_tj�|_|jt_t_tj	�dS)N)
�sys�stdout�save_stdout�stderr�save_stderr�io�StringIO�stream�atexit�_clear)�selfrrr�setUps
zGeneralTest.setUpcCs&|jt_|jt_tj�dS)N)rrrrrrr)rrrr�tearDown$szGeneralTest.tearDowncCsWtjt�tjt�tjtddd�tj�|j|jj�d�dS)N��kw�abcz"h4 (4,) {'kw': 'abc'}
h4 () {}
h1
)r�registerrr	�_run_exitfuncs�assertEqualr�getvalue)rrrr�	test_args)s


zGeneralTest.test_argscCsFtjdd�dddd�dD�dd�|jttj�dS)	NcSsdS)N�rrrrr�<lambda>4sz*GeneralTest.test_badargs.<locals>.<lambda>rcss|]}|VqdS)Nr)�.0�xrrr�	<genexpr>4sz+GeneralTest.test_badargs.<locals>.<genexpr>r&�)r&r+)rr!�assertRaisesrr")rrrr�test_badargs3s/zGeneralTest.test_badargscCsNtjt�tjt�tjt�tj�|j|jj�d�dS)Nz	h3
h2
h1
)	rr!rrrr"r#rr$)rrrr�
test_order7s




zGeneralTest.test_ordercCs1tjt�tjt�|jttj�dS)N)rr!r
rr,rr")rrrr�
test_raise@s

zGeneralTest.test_raisecCsCtjdd��|jttj�|jd|jj��dS)NcSsddS)Nr&rrrrrrr'Jsz5GeneralTest.test_raise_unnormalized.<locals>.<lambda>�ZeroDivisionError)rr!r,r0r"�assertInrr$)rrrr�test_raise_unnormalizedGsz#GeneralTest.test_raise_unnormalizedcCs�dd�}dd�}dd�}tj|�tj|�tj|�|jttj�|jj�}|j|jd�d�|j	d	|�|j	d
|�|j	d|�dS)NcSsdddS)Nr&rrrrrr�fQsz,GeneralTest.test_print_tracebacks.<locals>.fcSsdddS)Nr&rrrrrr�gSsz,GeneralTest.test_print_tracebacks.<locals>.gcSsdddS)Nr&rrrrrr�hUsz,GeneralTest.test_print_tracebacks.<locals>.hr0�z# onez# twoz# three)
rr!r,r0r"rr$r#�countr1)rr3r4r5rrrr�test_print_tracebacksOs


z!GeneralTest.test_print_tracebackscsadg��fdd�}x!td�D]}tj|�q(Wtj�|j�dd�dS)Nrcs�dd7<dS)Nrr&rr)�arr�incdsz$GeneralTest.test_stress.<locals>.inc�)�rangerr!r"r#)rr:�ir)r9r�test_stressbs	
zGeneralTest.test_stresscsTdg��fdd�}tj|�tj�tj�|j�dd�dS)Nrcs�dd7<dS)Nrr&rr)r9rrr:osz#GeneralTest.test_clear.<locals>.inc)rr!rr"r#)rr:r)r9r�
test_clearms	


zGeneralTest.test_clearcs�dg��fdd�}�fdd�}x!td�D]}tj|�q:Wtj|�tj|�tj�|j�dd�dS)	Nrcs�dd7<dS)Nrr&rr)r9rrr:zsz(GeneralTest.test_unregister.<locals>.inccs�dd8<dS)Nrr&rr)r9rr�dec|sz(GeneralTest.test_unregister.<locals>.decrr&���)r<rr!�
unregisterr"r#)rr:r@r=r)r9r�test_unregisterxs	


zGeneralTest.test_unregistercCsgg}tj|jd�tj�|j|dg�tj|j�tj�|j|dg�dS)N�)rr!�appendr"r#rB)r�lrrr�test_bound_methods�s

zGeneralTest.test_bound_methodsN)�__name__�
__module__�__qualname__rrr%r-r.r/r2r8r>r?rCrGrrrrrs
	rc@s(eZdZdd�Zdd�ZdS)�SubinterpreterTestcCsKtj�}d}tj|�}|j|d�|jtj�|�dS)Nz�if 1:
            import atexit
            def f():
                pass
            atexit.register(f)
            del atexit
            r)r�_ncallbacksr�run_in_subinterpr#)r�n�code�retrrr�test_callbacks_leak�s
z&SubinterpreterTest.test_callbacks_leakcCsKtj�}d}tj|�}|j|d�|jtj�|�dS)Nz�if 1:
            import atexit
            def f():
                pass
            atexit.register(f)
            atexit.__atexit = atexit
            r)rrLrrMr#)rrNrOrPrrr�test_callbacks_leak_refcycle�s
z/SubinterpreterTest.test_callbacks_leak_refcycleN)rHrIrJrQrRrrrrrK�srKcCstjt�dS)N)rZrun_unittestrHrrrr�	test_main�srS�__main__)rZunittestrrZtestrrrrr	r
rZTestCaserrKrSrHrrrr�<module>sw"