Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_unittest/testmock/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_unittest/testmock/__pycache__/testsealable.cpython-312.pyc

�

*Μg����ddlZddlmZGd�d�ZGd�dej�Zedk(rej�yy)�N)�mockc��eZdZd�Zd�Zy)�SampleObjectc��y�N���selfs �E/usr/local/lib/python3.12/test/test_unittest/testmock/testsealable.py�method_sample1zSampleObject.method_sample1���d�c��yrrr	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�Zy)�TestSealablec�T�tj�}|j|jtj�|j|j�tj�|j|j�j	�tj�yr)r�Mock�assertIsInstance�test�test2�r
�ms  r�,test_attributes_return_more_mocks_by_defaultz9TestSealable.test_attributes_return_more_mocks_by_defaults`���I�I�K�����a�f�f�d�i�i�0����a�f�f�h��	�	�2����a�f�f�h�n�n�.��	�	�:rc�$�tj�}tj|�|jt�5|j
ddd�|jt�5|�ddd�y#1swY�/xYw#1swYyxYwr�rr�seal�assertRaises�AttributeErrorrrs  r�.test_new_attributes_cannot_be_accessed_on_sealz;TestSealable.test_new_attributes_cannot_be_accessed_on_seals]���I�I�K���	�	�!��
�
�
�~�
.�
�F�F�/�
�
�
�~�
.�
�C�/�
.�/�
.��
.�
.�s�
A:�)B�:B�Bc��tj�}tj|�|jt�5d|_ddd�y#1swYyxYw�N�rrs  r�)test_new_attributes_cannot_be_set_on_sealz6TestSealable.test_new_attributes_cannot_be_set_on_seals9���I�I�K���	�	�!��
�
�
�~�
.��A�F�/�
.�
.���A�Ac���tj�}d|j_tj|�d|j_|j|jjd�y)Nr&�)rrrrr �assertEqualrs  r�+test_existing_attributes_can_be_set_on_sealz8TestSealable.test_existing_attributes_can_be_set_on_seal%sF���I�I�K��������	�	�!���������������q�)rc���tj�}d|j_tj|�|jt�5d|j_ddd�y#1swYyxYwr%)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-sH���I�I�K��������	�	�!��
�
�
�~�
.��A�F�F�L�/�
.�
.�s�A+�+A4c��tj�}d|j_tj|�|j|j�d�y)N�)rrr�return_valuer r+rs  r�+test_existing_attributes_allowed_after_sealz8TestSealable.test_existing_attributes_allowed_after_seal5s:���I�I�K��������	�	�!���������1�%rc��tjd��}tj|�|j|jd�y)Nr&)�
test_value)rrr r+r5rs  r�.test_initialized_attributes_allowed_after_sealz;TestSealable.test_initialized_attributes_allowed_after_seal=s/���I�I��#���	�	�!��������q�)rc��tj�}tj|�|jt�5|�ddd�y#1swYyxYwr)rrr r!r"rs  r�test_call_on_sealed_mock_failsz+TestSealable.test_call_on_sealed_mock_failsCs7���I�I�K���	�	�!��
�
�
�~�
.�
�C�/�
.�
.�r(c��tjd��}tj|�|j|�d�y)N�)r2)rrr r+rs  r�)test_call_on_defined_sealed_mock_succeedsz6TestSealable.test_call_on_defined_sealed_mock_succeedsJs-���I�I�1�%���	�	�!�������a� rc��tj�}d|jj�_tj
|�|j
|jj�jd�|jt�5|jj�jddd�|jt�5|jjddd�y#1swY�>xYw#1swYyxYw)N�)
rr�test1rr.r r+r!r"�test4rs  r�&test_seals_recurse_on_added_attributesz3TestSealable.test_seals_recurse_on_added_attributesPs����I�I�K�� !����
�
����	�	�!�����������.�.��2�
�
�
�~�
.�
�G�G�M�M�O�!�!�/�
�
�
�~�
.�
�G�G�M�M�/�
.�/�
.��
.�
.�s�%C4�D�4C=�D	c���tj�}d|jjd_d|jjdd_tj
|�|j
|jjdjd�|j
|jjddjd�|jt�5|jjdjddd�|jt�5|jjddjddd�y#1swY�KxYw#1swYyxYw)Nr=�ar*r:)
r�	MagicMockr>rr.r r+r!r"r?rs  r�#test_seals_recurse_on_magic_methodsz0TestSealable.test_seals_recurse_on_magic_methods\s����N�N���#$����
�
�c�� �#$����
�
�a��� ��	�	�!����������s�+�1�1�1�5���������q��+�1�1�1�5�
�
�
�~�
.�
�G�G�M�M�#��$�$�/�
�
�
�~�
.�
�G�G�M�M�!�A��$�$�/�
.�/�
.��
.�
.�s�!$E�"$E�E�E$c��tjd��}tjd��|j_d|jj_tj
|�|j
|jjjd�|jjjd|jj_y)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�I�;�'���	�	�|�4����
�����
�
���	�	�!����������,�,�a�0�	���
�
�������
�
�rc�X�tjt�}d|_d|_tj
|�|j
|jd�|j
|jd�|jt�5|jddd�y#1swYyxYw)z0You are not restricted when using mock with specr&r1N)
rrr�attr_sample1�attr_sample3r r+r!r"�attr_sample2rs  r�)test_integration_with_spec_att_definitionz6TestSealable.test_integration_with_spec_att_definitionusr���I�I�l�#���������	�	�!���������+��������+�
�
�
�~�
.�
�N�N�/�
.�
.�s�

B � B)c�6�tjt�}d|j_tj
|�|j
|j�d�|jt�5|j�ddd�y#1swYyxYw)z<You need to define the methods, even if they are in the specr&N)
rrrrr2r r+r!r"rrs  r�,test_integration_with_spec_method_definitionz9TestSealable.test_integration_with_spec_method_definition�sh���I�I�l�#��()����%��	�	�!������)�)�+�Q�/�
�
�
�~�
.�
����/�
.�
.�s�5B�Bc��tjt�}|jt�5d|j
_ddd�y#1swYyxYw)z)You cannot define methods out of the specr1N)rrrr!r"�method_sample3r2rs  r�:test_integration_with_spec_method_definition_respects_speczGTestSealable.test_integration_with_spec_method_definition_respects_spec�s8���I�I�l�#��
�
�
�~�
.�,-�A���)�/�
.�
.�s�A
�
Ac��tj�}tj|�|jt�5}|j
ddd�|j
dtj��y#1swY�/xYw)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�sT���I�I�K���	�	�!��
�
�
�~�
.�"�
�N�N�/��
�
�n�c�"�,�,�&7�8�/�
.�s�
A:�:Bc��tjd��}|jjjj
tj|�|jt�5}|jjjj
jddd�|jdtj��y#1swY�/xYw)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�I�;�'��	���
�
���!�!��	�	�!��
�
�
�~�
.�"�
�G�G�M�M���%�%�*�*�/��
�
�>��B�L�L�@Q�R�/�
.�s�+5C�Cc���tj�}|j�jj	�j
tj|�|jt�5}|j�jj	�j�ddd�|jdtj��y#1swY�/xYw)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�I�K��	���	������%�%��	�	�!��
�
�
�~�
.�"�
�G�G�I�O�O�!�!�#�)�)�+�/��
�
�8�#�b�l�l�:K�L�/�
.�s�17C�Cc�:
�Gd�d�}dD�]�}|j|��5tj||��}d|j_d|j
j_tj|�|j|jtj�|j|jtj�|j|jtj�|j|j
tj�|j|j
jtj�|j|j
jtj�|j|j�tj�|j|j�d�d|j_|j|j�d�|j|j
j
�d�d|j
j_|j|j
j
�d�|jt �5|j�ddd�|jt"�5d	|_ddd�|jt"�5|j�j&ddd�d
|j_|j|j�d
�|jt"�5|j(ddd�|jt"�5d	|_ddd�|jt"�5|j+�ddd�|jt �5|j
j�ddd�|jt"�5|j
j(ddd�|jt"�5d	|j
_ddd�|jt"�5|j
j+�ddd�ddd����y#1swY���xYw#1swY���xYw#1swY���xYw#1swY��cxYw#1swY��KxYw#1swY��*xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��
xYw)Nc�0�eZdZdZd�Zd�ZGd�d�Zy)�1TestSealable.test_seal_with_autospec.<locals>.Foorc��yrrr	s r�bar1z6TestSealable.test_seal_with_autospec.<locals>.Foo.bar1����Drc��yrrr	s r�bar2z6TestSealable.test_seal_with_autospec.<locals>.Foo.bar2�rhrc��eZdZdZd�Zy)�5TestSealable.test_seal_with_autospec.<locals>.Foo.Bazr1c��yrrr	s r�banz9TestSealable.test_seal_with_autospec.<locals>.Foo.Baz.ban�s��trN)rrr�bazrnrrr�Bazrl�s
����#rrpN)rrr�foorgrjrprrr�Foore�s���C� � �
$�
$rrr)TF)�spec_setrB�b�new_a�new_br&rj)�subTestr�create_autospecrgr2rprnr rrq�NonCallableMagicMockrCrjror+r!�	TypeErrorr"�bar�x�missing_attr�missing_method)r
rrrsrqs    r�test_seal_with_autospecz$TestSealable.test_seal_with_autospec�sB��	$�	$�&�H����x��0��*�*�3��B��(+����%�+.������(��	�	�#���%�%�c�g�g�t�/H�/H�I��%�%�c�h�h����?��%�%�c�h�h����?��%�%�c�g�g�t�~�~�>��%�%�c�g�g�k�k�4�3L�3L�M��%�%�c�g�g�k�k�4�>�>�B��%�%�c�h�h�j�$�.�.�A�� � �����S�1�(/����%�� � �����W�5�� � ��������4�+2������(�� � ��������8��&�&�y�1��G�G�I�2��&�&�~�6��C�G�7��&�&�~�6��H�H�J�L�L�7�)/����%�� � �����V�4��&�&�~�6��$�$�7��&�&�~�6�'(�C�$�7��&�&�~�6��&�&�(�7��&�&�y�1��G�G�K�K�M�2��&�&�~�6��G�G�(�(�7��&�&�~�6�+,�C�G�G�(�7��&�&�~�6��G�G�*�*�,�7�]1�0�&�22�1��6�6��6�6��7�6��6�6��6�6��1�1��6�6��6�6��6�6��]1�0�s��I,T�R� T�=R�T�"R,�=AT�
R9�T�5S�=T�S�+T�S �#T�S,�T�4S8�T�#T�>T�R�T�R)�$T�,R6�1T�9S�>T�S�T�S�T� S)�%T�,S5�1T�8T�=T�T
�	T�T	N)rrrrr#r'r,r/r3r6r8r;r@rDrJrOrQrTr\r`rbrrrrrrsc��;���*��&�*��!�
�%�	 ��	�.�9�S�M�;-rr�__main__)�unittestrr�TestCaserr�mainrrr�<module>r�sD����#�#�]-�8�$�$�]-�@�z���H�M�M�O�r

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