Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.11/unittest/test/testmock/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.11/unittest/test/testmock/__pycache__/testsealable.cpython-311.opt-1.pyc

�

TԚg����ddlZddlmZGd�d��ZGd�dej��Zedkrej��dSdS)�N)�mockc��eZdZd�Zd�ZdS)�SampleObjectc��dS�N���selfs �@/usr/local/lib/python3.11/unittest/test/testmock/testsealable.py�method_sample1zSampleObject.method_sample1�����c��dSrrr	s r�method_sample2zSampleObject.method_sample2	r
rN)�__name__�
__module__�__qualname__rrrrrrrs"������"�"�"�"�"�"�"�"rrc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�TestSealablec�b�tj��}|�|jtj��|�|���tj��|�|������tj��dSr)r�Mock�assertIsInstance�test�test2�r
�ms  r�,test_attributes_return_more_mocks_by_defaultz9TestSealable.test_attributes_return_more_mocks_by_defaultsw���I�K�K�����a�f�d�i�0�0�0����a�f�f�h�h��	�2�2�2����a�f�f�h�h�n�n�.�.��	�:�:�:�:�:rc�@�tj��}tj|��|�t��5|jddd��n#1swxYwY|�t��5|��ddd��dS#1swxYwYdSr�rr�seal�assertRaises�AttributeErrorrrs  r�.test_new_attributes_cannot_be_accessed_on_sealz;TestSealable.test_new_attributes_cannot_be_accessed_on_seals
���I�K�K���	�!����
�
�
�~�
.�
.�	�	�
�F�F�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�~�
.�
.�	�	�
�A�C�C�C�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s$�A�A�A�;B�B�Bc���tj��}tj|��|�t��5d|_ddd��dS#1swxYwYdS�N�rrs  r�)test_new_attributes_cannot_be_set_on_sealz6TestSealable.test_new_attributes_cannot_be_set_on_seals����I�K�K���	�!����
�
�
�~�
.�
.�	�	��A�F�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A�Ac���tj��}d|j_tj|��d|j_|�|jjd��dS)Nr&�)rrrrr �assertEqualrs  r�+test_existing_attributes_can_be_set_on_sealz8TestSealable.test_existing_attributes_can_be_set_on_seal%sL���I�K�K�������	�!��������������q�)�)�)�)�)rc���tj��}d|j_tj|��|�t��5d|j_ddd��dS#1swxYwYdSr%)rrrrr r!r"�test3rs  r�2test_new_attributes_cannot_be_set_on_child_of_sealz?TestSealable.test_new_attributes_cannot_be_set_on_child_of_seal-s����I�K�K�������	�!����
�
�
�~�
.�
.�	�	��A�F�L�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�
A(�(A,�/A,c��tj��}d|j_tj|��|�|���d��dS)N�)rrr�return_valuer r*rs  r�+test_existing_attributes_allowed_after_sealz8TestSealable.test_existing_attributes_allowed_after_seal5sH���I�K�K�������	�!������������1�%�%�%�%�%rc��tjd���}tj|��|�|jd��dS)Nr&)�
test_value)rrr r*r4rs  r�.test_initialized_attributes_allowed_after_sealz;TestSealable.test_initialized_attributes_allowed_after_seal=s?���I��#�#�#���	�!���������q�)�)�)�)�)rc���tj��}tj|��|�t��5|��ddd��dS#1swxYwYdSr)rrr r!r"rs  r�test_call_on_sealed_mock_failsz+TestSealable.test_call_on_sealed_mock_failsCs����I�K�K���	�!����
�
�
�~�
.�
.�	�	�
�A�C�C�C�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A�!Ac��tjd���}tj|��|�|��d��dS)N�)r1)rrr r*rs  r�)test_call_on_defined_sealed_mock_succeedsz6TestSealable.test_call_on_defined_sealed_mock_succeedsJsC���I�1�%�%�%���	�!�����������a� � � � � rc��tj��}d|j���_tj|��|�|j���jd��|�t��5|j���j	ddd��n#1swxYwY|�t��5|jjddd��dS#1swxYwYdS�N�)
rr�test1rr-r r*r!r"�test4rs  r�&test_seals_recurse_on_added_attributesz3TestSealable.test_seals_recurse_on_added_attributesPsL���I�K�K�� !���
�
�����	�!�������������.��2�2�2�
�
�
�~�
.�
.�	"�	"�
�G�M�M�O�O�!�!�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�
�
�
�~�
.�
.�	�	�
�G�M�M�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s$�B=�=C�C�"
C<�<D�Dc��tj��}d|jjd_d|jjdd�_tj|��|�|jjdjd��|�|jjdd�jd��|�t��5|jjdj	ddd��n#1swxYwY|�t��5|jjdd�j	ddd��dS#1swxYwYdS)Nr=�ar)r9)
r�	MagicMockr>rr-r r*r!r"r?rs  r�#test_seals_recurse_on_magic_methodsz0TestSealable.test_seals_recurse_on_magic_methods\s����N����#$���
�c�� �#$���
�a��c�� ��	�!����������s�+�1�1�5�5�5�������q��s�+�1�1�5�5�5�
�
�
�~�
.�
.�	%�	%�
�G�M�#��$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�
�
�
�~�
.�
.�	%�	%�
�G�M�!�A�#��$�$�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%�	%����	%�	%�	%�	%�	%�	%s$�
C.�.C2�5C2�D:�:D>�D>c�F�tjd���}tjd���|j_d|jj_tj|��|�|jjjd��|jjjd|jj_dS)N�	root_mock��name�
not_sealedr=r&)rrr>rr-r r*r?rs  r�,test_seals_dont_recurse_on_manual_attributesz9TestSealable.test_seals_dont_recurse_on_manual_attributesjs���I�;�'�'�'���	�|�4�4�4���
����
���	�!����������,�a�0�0�0�	��
������
���rc�\�tjt��}d|_d|_tj|��|�|jd��|�|jd��|�t��5|j	ddd��dS#1swxYwYdS)z0You are not restricted when using mock with specr&r0N)
rrr�attr_sample1�attr_sample3r r*r!r"�attr_sample2rs  r�)test_integration_with_spec_att_definitionz6TestSealable.test_integration_with_spec_att_definitionus����I�l�#�#���������	�!����������+�+�+�������+�+�+�
�
�
�~�
.�
.�	�	�
�N�N�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�B!�!B%�(B%c�V�tjt��}d|j_tj|��|�|���d��|�t��5|�	��ddd��dS#1swxYwYdS)z<You need to define the methods, even if they are in the specr&N)
rrrrr1r r*r!r"rrs  r�,test_integration_with_spec_method_definitionz9TestSealable.test_integration_with_spec_method_definition�s����I�l�#�#��()���%��	�!��������)�)�+�+�Q�/�/�/�
�
�
�~�
.�
.�	�	�
������	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�<B�B"�%B"c��tjt��}|�t��5d|j_ddd��dS#1swxYwYdS)z)You cannot define methods out of the specr0N)rrrr!r"�method_sample3r1rs  r�:test_integration_with_spec_method_definition_respects_speczGTestSealable.test_integration_with_spec_method_definition_respects_spec�s����I�l�#�#��
�
�
�~�
.�
.�	.�	.�,-�A��)�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.�	.����	.�	.�	.�	.�	.�	.s�
A�A�Ac��tj��}tj|��|�t��5}|jddd��n#1swxYwY|�dt|j����dS)N�SECRETE_name)	rrr r!r"rV�assertIn�str�	exception�r
r�cms   r�(test_sealed_exception_has_attribute_namez5TestSealable.test_sealed_exception_has_attribute_name�s����I�K�K���	�!����
�
�
�~�
.�
.�	�"�
�N�N�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��
�
�n�c�"�,�&7�&7�8�8�8�8�8s�A�A�Ac�n�tjd���}|jjjjtj|��|�t��5}|jjjjj	ddd��n#1swxYwY|�
dt|j����dS)N�	mock_namerGz&mock_name.test1.test2.test3.test4.boom)
rrr>rr-r?r r!r"�boomrWrXrYrZs   r�"test_attribute_chain_is_maintainedz/TestSealable.test_attribute_chain_is_maintained�s����I�;�'�'�'��	��
��!�!��	�!����
�
�
�~�
.�
.�	+�"�
�G�M��%�*�*�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+��
�
�>��B�L�@Q�@Q�R�R�R�R�Rs�B�B�	Bc���tj��}|���j���jtj|��|�t��5}|���j������ddd��n#1swxYwY|�	dt|j����dS)Nz mock.test1().test2.test3().test4)rrr>rr-r?r r!r"rWrXrYrZs   r�test_call_chain_is_maintainedz*TestSealable.test_call_chain_is_maintained�s����I�K�K��	���	�	������%�%��	�!����
�
�
�~�
.�
.�	,�"�
�G�G�I�I�O�!�!�#�#�)�)�+�+�+�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,�	,����	,�	,�	,�	,��
�
�8�#�b�l�:K�:K�L�L�L�L�Ls�2>B<�<C�Cc�	�Gd�d��}dD�]�}|�|���5tj||���}d|j_d|jj_tj|��|�|j	tj
��|�|jtj��|�|jtj��|�|jtj��|�|jj
tj
��|�|jjtj��|�|���d��d|j_|�|���d��|�|j���d��d|jj_|�|j���d��|�t ��5|�	��ddd��n#1swxYwY|�t"��5d	|_ddd��n#1swxYwY|�t"��5|���ddd��n#1swxYwYd
|j_|�|���d
��|�t"��5|jddd��n#1swxYwY|�t"��5d	|_ddd��n#1swxYwY|�t"��5|���ddd��n#1swxYwY|�t ��5|j�
��ddd��n#1swxYwY|�t"��5|jjddd��n#1swxYwY|�t"��5d	|j_ddd��n#1swxYwY|�t"��5|j���ddd��n#1swxYwYddd��n#1swxYwY���dS)Nc�8�eZdZdZd�Zd�ZGd�d��ZdS)�1TestSealable.test_seal_with_autospec.<locals>.Foorc��dSr%rr	s r�bar1z6TestSealable.test_seal_with_autospec.<locals>.Foo.bar1�����qrc��dS)Nr)rr	s r�bar2z6TestSealable.test_seal_with_autospec.<locals>.Foo.bar2�rhrc��eZdZdZd�ZdS)�5TestSealable.test_seal_with_autospec.<locals>.Foo.Bazr0c��dSr<rr	s r�banz9TestSealable.test_seal_with_autospec.<locals>.Foo.Baz.ban�s���1rN)rrr�bazrnrrr�Bazrl�s(������������rrpN)rrr�foorgrjrprrr�Foore�s_�������C�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
rrr)TF)�spec_setrB�b�new_a�new_br&rj)�subTestr�create_autospecrgr1rprnr rrq�NonCallableMagicMockrCrjror*r!�	TypeErrorr"�bar�missing_attr�missing_method)r
rrrsrqs    r�test_seal_with_autospecz$TestSealable.test_seal_with_autospec�s���
	�
	�
	�
	�
	�
	�
	�
	�&�-	-�-	-�H����x��0�0�,
-�,
-��*�3��B�B�B��(+���%�+.����(��	�#�����%�%�c�g�t�/H�I�I�I��%�%�c�h���?�?�?��%�%�c�h���?�?�?��%�%�c�g�t�~�>�>�>��%�%�c�g�k�4�3L�M�M�M��%�%�c�g�k�4�>�B�B�B�� � ������S�1�1�1�(/���%�� � ������W�5�5�5�� � ��������4�4�4�+2����(�� � ��������8�8�8��&�&�y�1�1����G�G�I�I�I��������������������&�&�~�6�6� � ��C�G� � � � � � � � � � � ���� � � � ��&�&�~�6�6����H�H�J�J�J�������������������)/���%�� � ������V�4�4�4��&�&�~�6�6�%�%��$�$�%�%�%�%�%�%�%�%�%�%�%����%�%�%�%��&�&�~�6�6�)�)�'(�C�$�)�)�)�)�)�)�)�)�)�)�)����)�)�)�)��&�&�~�6�6�)�)��&�&�(�(�(�)�)�)�)�)�)�)�)�)�)�)����)�)�)�)��&�&�y�1�1�"�"��G�K�K�M�M�M�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"��&�&�~�6�6�)�)��G�(�(�)�)�)�)�)�)�)�)�)�)�)����)�)�)�)��&�&�~�6�6�-�-�+,�C�G�(�-�-�-�-�-�-�-�-�-�-�-����-�-�-�-��&�&�~�6�6�-�-��G�*�*�,�,�,�-�-�-�-�-�-�-�-�-�-�-����-�-�-�-�W,
-�,
-�,
-�,
-�,
-�,
-�,
-�,
-�,
-�,
-�,
-����,
-�,
-�,
-�,
-��-	-�-	-s{�HS/�:I�S/�I�S/�"I�#S/�J�S/�J�S/�J�S/�9K�S/�K�S/�!K�"AS/�3M�;S/�M�S/�M�S/�,N�4S/�N�S/�N�S/�%O�:S/�O
�
S/�
O
�S/�+P�S/�P�S/�P�S/�6
Q�S/�Q�S/�Q�S/�4
R
�S/�
R�S/�R�S/�2S�S/�S�S/�S� S/�/S3	�6S3	N)rrrrr#r'r+r.r2r5r7r:r@rDrJrOrQrTr\r`rbr~rrrrrs7������;�;�;�������*�*�*����&�&�&�*�*�*����!�!�!�
�
�
�%�%�%�	 �	 �	 ����	�	�	�.�.�.�9�9�9�S�S�S�M�M�M�;-�;-�;-�;-�;-rr�__main__)�unittestrr�TestCaserr�mainrrr�<module>r�s�������������#�#�#�#�#�#�#�#�]-�]-�]-�]-�]-�8�$�]-�]-�]-�@�z����H�M�O�O�O�O�O��r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists