Your IP : 216.73.217.129


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_module.cpython-35.pyc



��Yf�!�@s�ddlZddlZddlmZmZddlmZddlZee�Z	Gdd�d�Z
Gdd�d�ZGdd	�d	ej�Z
ed
kr�ej�dS)�N)�
gc_collect�requires_type_collecting)�assert_python_okc@s"eZdZedd��ZdS)�
FullLoadercCsdj|j�S)Nz<module '{}' (crafted)>)�format�__name__)�cls�m�r
�5/opt/alt/python35/lib64/python3.5/test/test_module.py�module_reprszFullLoader.module_reprN)r�
__module__�__qualname__�classmethodrr
r
r
rr
src@seZdZdS)�
BareLoaderN)rr
rr
r
r
rrsrc@sHeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
edd��Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zed/d0��Zd1d2�Zd3S)4�ModuleTestscCs�tjt�}|j|jdk�|jtt|�y$|j}|jdt	|��Wnt
k
rpYnX|j|jtj�dS)Nz
__name__ = %s)
�
ModuleType�__new__�
assertTrue�__dict__�assertRaises�SystemError�dirrZfail�repr�AttributeError�assertEqual�__doc__)�self�foo�sr
r
r�test_uninitializeds	
zModuleTests.test_uninitializedcCs,tjt�}|jtdt|d�dS)Nz"module has no attribute 'not_here'�not_here)rr�assertRaisesRegexr�getattr)rrr
r
r�"test_uninitialized_missing_getattr!sz.ModuleTests.test_uninitialized_missing_getattrcCs)td�}|jtdt|d�dS)Nrz(module 'foo' has no attribute 'not_here'r!)rr"rr#)rrr
r
r�test_missing_getattr)sz ModuleTests.test_missing_getattrcCs�td�}|j|jd�|j|jd�|j|jd�|j|jd�|j|jd�|j|jddddddddddi�dS)Nrrr�
__loader__�__package__�__spec__)	rrrr�assertIsr&r'r(r)rrr
r
r�test_no_docstring1szModuleTests.test_no_docstringcCsjtdd�}|j|jd�|j|jd�|j|jddddddddddi�dS)Nr�foodocrrr&r'r()rrrrr)rrr
r
r�test_ascii_docstring=sz ModuleTests.test_ascii_docstringcCsjtdd�}|j|jd�|j|jd�|j|jddddddddddi�dS)Nru	foodocሴrrr&r'r()rrrrr)rrr
r
r�test_unicode_docstringGsz"ModuleTests.test_unicode_docstringcCs�tdd�}d|_|j}|jdd�|j|jd�|j|jd�|j|jd�|j|jddddddddd	dd
di�|j|j|k�dS)Nru	foodocሴ�*r+rr�barr&r'r()rr/r�__init__rrrr)rr�dr
r
r�test_reinitQs		zModuleTests.test_reinitcCs1dd�}t�|j|�jdd�dS)NcSstd�}d|_|S)Nr�)rr/)rr
r
r�fas	z+ModuleTests.test_dont_clear_dict.<locals>.fr/r3)rrr)rr4r
r
r�test_dont_clear_dict_sz ModuleTests.test_dont_clear_dictcCsRg}td�}||_d}t||j�~t�|j|dg�dS)Nrzwclass A:
    def __init__(self, l):
        self.l = l
    def __del__(self):
        self.l.append(1)
a = A(destroyed)�)r�	destroyed�execrrr)rr7r	rr
r
r�test_clear_dict_in_ref_cyclehs	z(ModuleTests.test_clear_dict_in_ref_cyclecCsOtd�}tj|�}|j|�|�~t�|j|�d�dS)Nr)r�weakref�refr)r)rr	�wrr
r
r�test_weakrefxszModuleTests.test_weakrefcCs,td�}|`|jt|�d�dS)Nrz<module '?'>)rrrr)rr	r
r
r�test_module_repr_minimal�sz$ModuleTests.test_module_repr_minimalcCs&td�}|jt|�d�dS)Nrz<module 'foo'>)rrr)rr	r
r
r�test_module_repr_with_name�sz&ModuleTests.test_module_repr_with_namecCs/td�}d|_|jt|�d�dS)Nrz/tmp/foo.pyz!<module 'foo' from '/tmp/foo.py'>)r�__file__rr)rr	r
r
r�'test_module_repr_with_name_and_filename�s	z3ModuleTests.test_module_repr_with_name_and_filenamecCs5td�}|`d|_|jt|�d�dS)Nrz/tmp/foo.pyz<module '?' from '/tmp/foo.py'>)rrr@rr)rr	r
r
r�#test_module_repr_with_filename_only�s	z/ModuleTests.test_module_repr_with_filename_onlycCs;td�}|jdks!t�|jt|�d�dS)Nrz<module 'foo'>)rr&�AssertionErrorrr)rr	r
r
r�$test_module_repr_with_loader_as_None�sz0ModuleTests.test_module_repr_with_loader_as_NonecCsJtd�}|`t|_tt�}|jt|�dj|��dS)Nrz<module '?' ({})>)rrrr&rrr)rr	�loader_reprr
r
r�-test_module_repr_with_bare_loader_but_no_name�s	z9ModuleTests.test_module_repr_with_bare_loader_but_no_namecCsJtd�}|`t|_tt�}|jt|�dj|��dS)Nrz<module '?' ({})>)rrrr&rrr)rr	rEr
r
r�-test_module_repr_with_full_loader_but_no_name�s	z9ModuleTests.test_module_repr_with_full_loader_but_no_namecCsDtd�}t|_tt�}|jt|�dj|��dS)Nrz<module 'foo' ({})>)rrr&rrr)rr	rr
r
r�!test_module_repr_with_bare_loader�s
	z-ModuleTests.test_module_repr_with_bare_loadercCs/td�}t|_|jt|�d�dS)Nrz<module 'foo' (crafted)>)rrr&rr)rr	r
r
r�!test_module_repr_with_full_loader�s	z-ModuleTests.test_module_repr_with_full_loadercCs8td�}t|_d|_|jt|�d�dS)Nrz/tmp/foo.pyz!<module 'foo' from '/tmp/foo.py'>)rrr&r@rr)rr	r
r
r�.test_module_repr_with_bare_loader_and_filename�s		z:ModuleTests.test_module_repr_with_bare_loader_and_filenamecCs8td�}t|_d|_|jt|�d�dS)Nrz/tmp/foo.pyz<module 'foo' (crafted)>)rrr&r@rr)rr	r
r
r�.test_module_repr_with_full_loader_and_filename�s		z:ModuleTests.test_module_repr_with_full_loader_and_filenamecCs|jtt�d�dS)Nz<module 'sys' (built-in)>)rr�sys)rr
r
r�test_module_repr_builtin�sz$ModuleTests.test_module_repr_builtincCs{tt�}d}d}|j|dt|��|dj||��|j|t|�d�|dj||��dS)Nz<module 'unittest' from 'z
__init__.py'>z{!r} does not start with {!r}z{!r} does not end with {!r})r�unittestr�lenr)r�rZstarts_withZ	ends_withr
r
r�test_module_repr_source�sz#ModuleTests.test_module_repr_sourcecCs]tdd�\}}}|j|�|j�}|jt|�ddddddh�dS)	Nz-czfrom test import final_asx = asx = bs
final_a.x = as
final_b.x = bs	len = lensshutil.rmtree = rmtree)rZassertFalse�
splitlinesr�set)r�rc�out�err�linesr
r
r�$test_module_finalization_at_shutdown�s
z0ModuleTests.test_module_finalization_at_shutdowncsOGdd�d��G�fdd�dt�}|jtt|d�d�dS)Nc@seZdZdd�ZdS)z;ModuleTests.test_descriptor_errors_propagate.<locals>.DescrcSs
t�dS)N)�RuntimeError)r�o�tr
r
r�__get__�szCModuleTests.test_descriptor_errors_propagate.<locals>.Descr.__get__N)rr
rr\r
r
r
r�Descr�sr]cseZdZ��ZdS)z7ModuleTests.test_descriptor_errors_propagate.<locals>.MN)rr
r�melonr
)r]r
r�M�sr_Zmymodr^)rrrYr#)rr_r
)r]r� test_descriptor_errors_propagate�sz,ModuleTests.test_descriptor_errors_propagateN)rr
rr r$r%r*r,r-r2r5rr9r=r>r?rArBrDrFrGrHrIrJrKrMrQrXr`r
r
r
rrs2


			r�__main__)rNr:Ztest.supportrrZtest.support.script_helperrrL�typerrrZTestCaserr�mainr
r
r
r�<module>s�