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_module.cpython-34.pyc

�
f f��@s�ddlZddlZddlmZmZddlmZddlZee�Z	Gdd�d�Z
Gdd�d�ZGdd	�d	ej�Z
d
d�Zedkr�e�ndS)
�N)�run_unittest�
gc_collect)�assert_python_okc@s"eZdZedd��ZdS)�
FullLoadercCsdj|j�S)Nz<module '{}' (crafted)>)�format�__name__)�cls�m�r
�5/opt/alt/python34/lib64/python3.4/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@sieZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Ze	j
eed
�d�dd��Z
e	j
eed
�d�dd��Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Ze	j
eed
�d-�d.d/��Zd0S)1�ModuleTestscCs�tjt�}|j|jdk�|jtt|�y$|j}|jdt	|��Wnt
k
rpYnX|j|jtj�dS)Nz
__name__ = %s)
�
ModuleType�__new__�
assertTrue�__dict__ZassertRaises�SystemError�dirrZfail�repr�AttributeError�assertEqual�__doc__)�self�foo�sr
r
r�test_uninitializeds	
zModuleTests.test_uninitializedcCs�td�}|j|jd�|j|jd�|j|jd�|j|jd�|j|jd�|j|jidd6dd6dd6dd6dd6�dS)Nrrr�
__loader__�__package__�__spec__)	rrrr�assertIsr r!r"r)rrr
r
r�test_no_docstring!szModuleTests.test_no_docstringcCsotdd�}|j|jd�|j|jd�|j|jidd6dd6dd6dd6dd6�dS)Nr�foodocrrr r!r")rrrrr)rrr
r
r�test_ascii_docstring-sz ModuleTests.test_ascii_docstringcCsotdd�}|j|jd�|j|jd�|j|jidd6dd6dd6dd6dd6�dS)Nru	foodocሴrrr r!r")rrrrr)rrr
r
r�test_unicode_docstring7sz"ModuleTests.test_unicode_docstringcCs�tdd�}d|_|j}|jdd�|j|jd�|j|jd�|j|jd�|j|jidd6dd6dd6dd6dd	6dd
6�|j|j|k�dS)Nru	foodocሴ�*r%rr�barr r!r")rr)r�__init__rrrr)rr�dr
r
r�test_reinitAs		zModuleTests.test_reinitcCs1dd�}t�|j|�jdd�dS)NcSstd�}d|_|S)Nr�)rr))rr
r
r�fQs	z+ModuleTests.test_dont_clear_dict.<locals>.fr)r-)rrr)rr.r
r
r�test_dont_clear_dictOsz ModuleTests.test_dont_clear_dictZ	getcountsz*types are immortal if COUNT_ALLOCS is usedcCsRg}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)rr1r	rr
r
r�test_clear_dict_in_ref_cycleXs	z(ModuleTests.test_clear_dict_in_ref_cyclecCsOtd�}tj|�}|j|�|�~t�|j|�d�dS)Nr)r�weakref�refr#r)rr	�wrr
r
r�test_weakrefiszModuleTests.test_weakrefcCs,td�}|`|jt|�d�dS)Nrz<module '?'>)rrrr)rr	r
r
r�test_module_repr_minimalssz$ModuleTests.test_module_repr_minimalcCs&td�}|jt|�d�dS)Nrz<module 'foo'>)rrr)rr	r
r
r�test_module_repr_with_nameys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	r?r
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_sourcez4skipping since COUNT_ALLOCS was used, see issue19527cCs]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_shutdownN)rr
rrr$r&r'r,r/rHZskipIf�hasattrrFr3r7r8r9r;r<r>r@rArBrCrDrErGrKrRr
r
r
rrs2


				rcCstt�dS)N)rrr
r
r
r�	test_main�srT�__main__)rHr4Ztest.supportrrZtest.script_helperrrF�typerrrZTestCaserrTrr
r
r
r�<module>s�