Your IP : 216.73.216.213


Current Path : /opt/alt/python311/lib64/python3.11/test/test_module/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/test/test_module/__pycache__/__init__.cpython-311.pyc

�

�0�i�4����ddlZddlZddlmZddlmZddlmZddlZee��Z	Gd�d��Z
Gd�d��ZGd	�d
ej��Z
edkrej��dSdS)�N)�
gc_collect)�
import_helper)�assert_python_okc�$�eZdZed���ZdS)�
FullLoaderc�6�d�|j��S)Nz<module '{}' (crafted)>)�format�__name__)�cls�ms  �@/opt/alt/python311/lib64/python3.11/test/test_module/__init__.py�module_reprzFullLoader.module_reprs��(�/�/��
�;�;�;�N)r
�
__module__�__qualname__�classmethodr�rr
rrs-�������<�<��[�<�<�<rrc��eZdZdS)�
BareLoaderN)r
rrrrr
rrs�������Drrc���eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%S)&�ModuleTestsc��t�t��}|�t|jt
����|�t|��g��	|j}|�	dt|��z��n#t$rYnwxYw|�|jtjpd��dS)Nz
__name__ = %s�)
�
ModuleType�__new__�
assertTrue�
isinstance�__dict__�dict�assertEqual�dirr
�fail�repr�AttributeError�__doc__)�self�foo�ss   r
�test_uninitializedzModuleTests.test_uninitializeds���� � ��,�,�����
�3�<��6�6�7�7�7�����S���2�&�&�&�	���A��I�I�o��Q���/�0�0�0�0���	�	�	��D�	���������j�&8�&>�B�?�?�?�?�?s�1,B�
B+�*B+c��t�t��}|�tdt|d��dS)Nz"module has no attribute 'not_here'�not_here)rr�assertRaisesRegexr$�getattr�r&r's  r
�"test_uninitialized_missing_getattrz.ModuleTests.test_uninitialized_missing_getattr"sF��� � ��,�,������ D���j�	*�	*�	*�	*�	*rc�j�td��}|�tdt|d��dS)Nr'z(module 'foo' has no attribute 'not_here'r+)rr,r$r-r.s  r
�test_missing_getattrz ModuleTests.test_missing_getattr*s@����������� J���j�	*�	*�	*�	*�	*rc	�t�td��}|�|jd��|�|jd��|�|jd��|�|jd��|�|jd��|�|jdddddd���dS)Nr'�r
r%�
__loader__�__package__�__spec__)	rr r
r%�assertIsr4r5r6rr.s  r
�test_no_docstringzModuleTests.test_no_docstring2s�������������u�-�-�-������d�+�+�+��
�
�c�n�d�+�+�+��
�
�c�o�t�,�,�,��
�
�c�l�D�)�)�)������E�d�6:�4�48�(:�(:�	;�	;�	;�	;�	;rc	���tdd��}|�|jd��|�|jd��|�|jdddddd���dS)Nr'�foodocr3�rr r
r%rr.s  r
�test_ascii_docstringz ModuleTests.test_ascii_docstring>s~�����)�)�������u�-�-�-������h�/�/�/������&+��(,�T�&*�,�,�	-�	-�	-�	-�	-rc	���tdd��}|�|jd��|�|jd��|�|jdddddd���dS)Nr'�	foodocሴr3r;r.s  r
�test_unicode_docstringz"ModuleTests.test_unicode_docstringHs~�����/�/�������u�-�-�-������n�5�5�5������&+��(,�T�&*�,�,�	-�	-�	-�	-�	-rc
��tdd��}d|_|j}|�dd��|�|jd��|�|jd��|�|jd��|�|jddddddd���|�|j|u��dS)Nr'r>�*r:)r
r%�barr4r5r6)rrBr�__init__r r
r%r)r&r'�ds   r
�test_reinitzModuleTests.test_reinitRs������/�/������L�����U�H�%�%�%������u�-�-�-������h�/�/�/������"�%�%�%������ �X�b�!�$�D�J�J�	K�	K�	K�	
������)�*�*�*�*�*rc�z�d�}t��|�|��jdd��dS)Nc�2�td��}d|_|S)Nr'�)rrB)r's r
�fz+ModuleTests.test_dont_clear_dict.<locals>.fbs���U�#�#�C��C�G��JrrBrH)rr r)r&rIs  r
�test_dont_clear_dictz ModuleTests.test_dont_clear_dict`sE��	�	�	�	������������e�,�a�0�0�0�0�0rc��g}td��}||_d}t||j��~t	��|�|dg��dS)Nr'zwclass A:
    def __init__(self, l):
        self.l = l
    def __del__(self):
        self.l.append(1)
a = A(destroyed)�)r�	destroyed�execrrr )r&rMrr(s    r
�test_clear_dict_in_ref_cyclez(ModuleTests.test_clear_dict_in_ref_cycleis`���	��u�������
��	
�Q��
����
���������Q�C�(�(�(�(�(rc���td��}tj|��}|�|��|��~t	��|�|��d��dS�Nr')r�weakref�refr7r)r&r�wrs   r
�test_weakrefzModuleTests.test_weakrefxsb���u����
�[��^�^���
�
�b�b�d�d�A����
������
�
�b�b�d�d�D�!�!�!�!�!rc��ddlmcm}ddlm}|�|d��|�|jd��|�|jd��|�td��5|j	ddd��n#1swxYwY|�|j
d��tjd=dS)	Nr)�testz
There is testrL�z Deprecated, use whatever insteadzThere is whatever�test.test_module.good_getattr)
�test.test_module.good_getattr�test_module�good_getattrrWr �x�yr,r$�yolo�whatever�sys�modules)r&�ggarWs   r
�test_module_getattrzModuleTests.test_module_getattr�s��3�3�3�3�3�3�3�3�3�6�6�6�6�6�6������/�/�/�������"�"�"�������"�"�"�
�
#�
#�N�$F�H�H�	�	��H�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
�����':�;�;�;��K�7�8�8�8s�7B�B�Bc���ddlmcm}ddlm}|�|jd��|�|jd��|�t��5|j	ddd��n#1swxYwY|�t��5|j	ddd��n#1swxYwYtjd=dtjvrtjd=dSdS)Nr��bad_getattr2rL�test.test_module.bad_getattr�test.test_module.bad_getattr2)�test.test_module.bad_getattrr[�bad_getattr�test.test_modulergr r]�assertRaises�	TypeError�noperarb�r&�bgargs   r
�test_module_getattr_errorsz&ModuleTests.test_module_getattr_errors�sr��2�2�2�2�2�2�2�2�2�1�1�1�1�1�1�������"�"�"�������+�+�+�
�
�
�y�
)�
)�	�	��H�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��K�6�7�*�c�k�9�9���;�<�<�<�:�9s$� A4�4A8�;A8�B-�-B1�4B1c�|�ddlmcm}|�t	|��gd���t
jd=dS)Nr)�a�b�crY)rZr[r\r r!rarb)r&rcs  r
�test_module_dirzModuleTests.test_module_dir�sN��3�3�3�3�3�3�3�3�3�����S���?�?�?�3�3�3��K�7�8�8�8rc�|�ddlmcm}ddlm}|�t��5t|��ddd��n#1swxYwY|�t��5t|��ddd��n#1swxYwYtj	d=dtj	vrtj	d=dSdS)Nrrfrhri)
rjr[rkrlrgrmrnr!rarbrps   r
�test_module_dir_errorsz"ModuleTests.test_module_dir_errors�sK��2�2�2�2�2�2�2�2�2�1�1�1�1�1�1�
�
�
�y�
)�
)�	�	���H�H�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	������	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��K�6�7�*�c�k�9�9���;�<�<�<�:�9s#�A�A
�
A
�+B�B�Bc�0�ddlm}|�t��5|jddd��n#1swxYwY|�t��5|jddd��n#1swxYwYdtjvrtjd=dSdS)Nr)�bad_getattr3ztest.test_module.bad_getattr3)rlr{rmr$�one�
delgetattrrarb)r&r{s  r
�test_module_getattr_trickyz&ModuleTests.test_module_getattr_tricky�s��1�1�1�1�1�1�
�
�
�~�
.�
.�	�	����	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�~�
.�
.�	$�	$��#�#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�*�c�k�9�9���;�<�<�<�:�9s�5�9�9�A.�.A2�5A2c�n�td��}|`|�t|��d��dS)Nr'z<module '?'>)rr
r r#�r&rs  r
�test_module_repr_minimalz$ModuleTests.test_module_repr_minimal�s6���u����
�J�����a���.�1�1�1�1�1rc�j�td��}|�t|��d��dS�Nr'z<module 'foo'>)rr r#r�s  r
�test_module_repr_with_namez&ModuleTests.test_module_repr_with_name�s2���u��������a���"2�3�3�3�3�3rc�x�td��}d|_|�t|��d��dS�Nr'�/tmp/foo.pyz!<module 'foo' from '/tmp/foo.py'>)r�__file__r r#r�s  r
�'test_module_repr_with_name_and_filenamez3ModuleTests.test_module_repr_with_name_and_filename�s9���u����"��
�����a���"E�F�F�F�F�Frc�|�td��}|`d|_|�t	|��d��dS)Nr'r�z<module '?' from '/tmp/foo.py'>)rr
r�r r#r�s  r
�#test_module_repr_with_filename_onlyz/ModuleTests.test_module_repr_with_filename_only�s>���u����
�J�"��
�����a���"C�D�D�D�D�Drc�|�td��}|j�J�|�t|��d��dSr�)rr4r r#r�s  r
�$test_module_repr_with_loader_as_Nonez0ModuleTests.test_module_repr_with_loader_as_None�s@���u�����|�#�#�#�����a���"2�3�3�3�3�3rc���td��}|`t|_t	t��}|�t	|��d�|����dS�Nr'z<module '?' ({})>)rr
rr4r#r r	�r&r�loader_reprs   r
�-test_module_repr_with_bare_loader_but_no_namez9ModuleTests.test_module_repr_with_bare_loader_but_no_name�sd���u����
�J�!����:�&�&�������G�G�(�/�/��<�<�	>�	>�	>�	>�	>rc���td��}|`t|_t	t��}|�t	|��d�|����dSr�)rr
rr4r#r r	r�s   r
�-test_module_repr_with_full_loader_but_no_namez9ModuleTests.test_module_repr_with_full_loader_but_no_name�sf��
�u����
�J�!����:�&�&�������G�G�(�/�/��<�<�	>�	>�	>�	>�	>rc���td��}t|_tt��}|�t|��d�|����dS)Nr'z<module 'foo' ({})>)rrr4r#r r	)r&rrs   r
�!test_module_repr_with_bare_loaderz-ModuleTests.test_module_repr_with_bare_loader�sd���u����!����:�&�&�������G�G�*�1�1�+�>�>�	@�	@�	@�	@�	@rc��td��}t|_|�t	|��d��dS)Nr'�<module 'foo' (crafted)>)rrr4r r#r�s  r
�!test_module_repr_with_full_loaderz-ModuleTests.test_module_repr_with_full_loader�sD���u����!��������G�G�/�	1�	1�	1�	1�	1rc��td��}t|_d|_|�t|��d��dSr�)rrr4r�r r#r�s  r
�.test_module_repr_with_bare_loader_and_filenamez:ModuleTests.test_module_repr_with_bare_loader_and_filename�s@���u����!���"��
�����a���"E�F�F�F�F�Frc��td��}t|_d|_|�t|��d��dS)Nr'r�r�)rrr4r�r r#r�s  r
�.test_module_repr_with_full_loader_and_filenamez:ModuleTests.test_module_repr_with_full_loader_and_filename�s@���u����!���"��
�����a���"<�=�=�=�=�=rc�V�|�tt��d��dS)Nz<module 'sys' (built-in)>)r r#ra)r&s r
�test_module_repr_builtinz$ModuleTests.test_module_repr_builtins%������c���$?�@�@�@�@�@rc�8�tt��}d}d}|�|dt|���|d�||����|�|t|��d�|d�||����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&�r�starts_with�	ends_withs    r
�test_module_repr_sourcez#ModuleTests.test_module_repr_sources�����N�N��1��#�	�����,�C��,�,�,�-�{�8�?�?��;�O�O�	Q�	Q�	Q�����C�	�N�N�?�+�+�,�i�6�=�=�a��K�K�	M�	M�	M�	M�	Mrc���tdd��\}}}|�|��|���}|�t	|��hd���dS)Nz-cz$from test.test_module import final_a>�x = a�x = b�	len = len�
final_a.x = a�
final_b.x = b�shutil.rmtree = rmtree)r�assertFalse�
splitlinesr �set)r&�rc�out�err�liness     r
�$test_module_finalization_at_shutdownz0ModuleTests.test_module_finalization_at_shutdown
st��'��.T�U�U���C������������ � ������U���&'�&'�&'�	(�	(�	(�	(�	(rc���Gd�d���G�fd�dt��}|�tt|d��d��dS)Nc��eZdZd�ZdS)�;ModuleTests.test_descriptor_errors_propagate.<locals>.Descrc��t��N)�RuntimeError)r&�o�ts   r
�__get__zCModuleTests.test_descriptor_errors_propagate.<locals>.Descr.__get__s��"�"rN)r
rrr�rrr
�Descrr�s#������
#�
#�
#�
#�
#rr�c�$��eZdZ���ZdS)�7ModuleTests.test_descriptor_errors_propagate.<locals>.MN)r
rr�melon)r�s�r
�Mr�s��������E�G�G�E�E�Err��mymodr�)rrmr�r-)r&r�r�s  @r
� test_descriptor_errors_propagatez,ModuleTests.test_descriptor_errors_propagates����	#�	#�	#�	#�	#�	#�	#�	#�	�	�	�	�	�	�	�
�	�	�	����,����7���W�E�E�E�E�Erc�^�td��}td��D]�}|�d|jv��|j}|�d|jv��|�|j|��|�|jd|��|dzr|`��|jd=��dS)Nr'rH�__annotations__rX)r�ranger�rr�rr �r&r'�irDs    r
�test_lazy_create_annotationsz(ModuleTests.test_lazy_create_annotations"s���������q���		4�		4�A����.�#�,�>�?�?�?��#�A��O�O�-���=�>�>�>����S�0�!�4�4�4����S�\�*;�<�a�@�@�@��1�u�
4��'�'��L�!2�3�3�		4�		4rc�p�td��}td��D]�}|�d|jv��dti}||_|�d|jv��|�|j|��|�|jd|��|dzr|`��|jd=��dS)Nr'rHr�rtrX)rr�r�r�intr�rr r�s    r
�test_setting_annotationsz$ModuleTests.test_setting_annotations2s���������q���
	4�
	4�A����.�#�,�>�?�?�?��c�
�A�"#�C���O�O�-���=�>�>�>����S�0�!�4�4�4����S�\�*;�<�a�@�@�@��1�u�
4��'�'��L�!2�3�3�
	4�
	4rc��td��}i|_|`|�t��5|`ddd��dS#1swxYwYdSrQ)rr�rmr$r.s  r
�test_annotations_getset_raisesz*ModuleTests.test_annotations_getset_raises@s�������� �����
�
�
�~�
.�
.�	$�	$��#�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$�	$����	$�	$�	$�	$�	$�	$s�A�A�
Ac��tjd��}|�d|jv��|`|�d|jv��dS)Nztest.typinganndata.ann_module4r�)r�import_fresh_modulerrr�r�)r&�ann_module4s  r
�&test_annotations_are_created_correctlyz2ModuleTests.test_annotations_are_created_correctlyHs]��#�7�,�
�
��	
���)�[�-A�A�B�B�B��'����*�k�.B�B�C�C�C�C�Crc���td��}|j}d}td��D](}d|_||jz
}|�d���)|�|d��dS)NrWr�drL�attr)rrr�r��popr )r&rrD�count�_s     r
�test_repeated_attribute_popsz(ModuleTests.test_repeated_attribute_popsQsq��
�v����
�J�����s���	�	�A��A�F��Q�V�O�E�
�E�E�&�M�M�M�M������$�$�$�$�$rc��Gd�dt��}|d��}|�t��5|jddd��n#1swxYwY|�t��5|jddd��n#1swxYwYd\|_|_|�|jd��|�|jd��dS)Nc�"��eZdZdZ�fd�Z�xZS)�=ModuleTests.test_subclass_with_slots.<locals>.ModuleWithSlots)rtruc�J��t���|��dSr�)�superrC)r&�name�	__class__s  �r
rCzFModuleTests.test_subclass_with_slots.<locals>.ModuleWithSlots.__init__es!������ � ��&�&�&�&�&r)r
rr�	__slots__rC�
__classcell__)r�s@r
�ModuleWithSlotsr�bs=�������"�I�
'�
'�
'�
'�
'�
'�
'�
'�
'rr�r�)rLrXrLrX)rrmr$rtrur )r&r�rs   r
�test_subclass_with_slotsz$ModuleTests.test_subclass_with_slots_s`��	'�	'�	'�	'�	'�j�	'�	'�	'�
�O�F�#�#��
�
�
�~�
.�
.�	�	�
�C�C�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�~�
.�
.�	�	�
�C�C�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����Q�S������a� � � ������a� � � � � s#�A
�
A�A�2B�B
�
B
N)'r
rrr)r/r1r8r<r?rErJrOrUrdrrrwryr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
rrsK������@�@�@�*�*�*�*�*�*�
;�
;�
;�-�-�-�-�-�-�+�+�+�1�1�1�
)�
)�
)�"�"�"�
9�
9�
9�=�=�=�9�9�9�
	=�	=�	=�=�=�=�2�2�2�4�4�4�G�G�G�
E�E�E�4�4�4�
>�>�>�
>�
>�
>�@�@�@�1�1�1�G�G�G�>�>�>�A�A�A�M�M�M�(�(�(�F�F�F�4�4�4� 4�4�4�$�$�$�D�D�D�
%�
%�
%�!�!�!�!�!rr�__main__)r�rR�test.supportrr�test.support.script_helperrra�typerrr�TestCaserr
�mainrrr
�<module>r�s����������#�#�#�#�#�#�&�&�&�&�&�&�7�7�7�7�7�7�
�
�
�
�
�T�#�Y�Y�
�<�<�<�<�<�<�<�<�
	�	�	�	�	�	�	�	�[!�[!�[!�[!�[!�(�#�[!�[!�[!�~
�z����H�M�O�O�O�O�O��r