HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/unittest/test/testmock/__pycache__/testsealable.cpython-37.opt-2.pyc
B

"��g��@sHddlZddlmZGdd�d�ZGdd�dej�ZedkrDe��dS)�N)�mockc@s$eZdZdd�Zdd�Zdd�ZdS)�SampleObjectcCsd|_d|_dS)N�)�attr_sample1�attr_sample2)�self�r�?/usr/local/lib/python3.7/unittest/test/testmock/testsealable.py�__init__szSampleObject.__init__cCsdS)Nr)rrrr	�method_sample1
szSampleObject.method_sample1cCsdS)Nr)rrrr	�method_sample2
szSampleObject.method_sample2N)�__name__�
__module__�__qualname__r
rrrrrr	rsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)&�TestSealablecCsDt��}|�|jtj�|�|��tj�|�|����tj�dS)N)r�MockZassertIsInstance�test�test2)r�mrrr	�,test_attributes_return_more_mocks_by_defaultsz9TestSealable.test_attributes_return_more_mocks_by_defaultc	CsNt��}t�|�|�t��|jWdQRX|�t��|�WdQRXdS)N)rr�seal�assertRaises�AttributeErrorr)rrrrr	�.test_new_attributes_cannot_be_accessed_on_seals
z;TestSealable.test_new_attributes_cannot_be_accessed_on_sealc	Cs2t��}t�|�|�t��d|_WdQRXdS)Nr)rrrrrr)rrrrr	�)test_new_attributes_cannot_be_set_on_seal#s
z6TestSealable.test_new_attributes_cannot_be_set_on_sealcCs6t��}d|j_t�|�d|j_|�|jjd�dS)Nr�)rrrrr�assertEqual)rrrrr	�+test_existing_attributes_can_be_set_on_seal*s

z8TestSealable.test_existing_attributes_can_be_set_on_sealc	Cs<t��}d|j_t�|�|�t��d|j_WdQRXdS)Nr)rrrrrrr�test3)rrrrr	�2test_new_attributes_cannot_be_set_on_child_of_seal2s

z?TestSealable.test_new_attributes_cannot_be_set_on_child_of_sealcCs.t��}d|j_t�|�|�|��d�dS)N�)rrr�return_valuerr)rrrrr	�+test_existing_attributes_allowed_after_seal:s
z8TestSealable.test_existing_attributes_allowed_after_sealcCs(tjdd�}t�|�|�|jd�dS)Nr)�
test_value)rrrrr#)rrrrr	�.test_initialized_attributes_allowed_after_sealBs
z;TestSealable.test_initialized_attributes_allowed_after_sealc	Cs2t��}t�|�|�t��|�WdQRXdS)N)rrrrr)rrrrr	�test_call_on_sealed_mock_failsHs
z+TestSealable.test_call_on_sealed_mock_failscCs(tjdd�}t�|�|�|�d�dS)N�)r!)rrrr)rrrrr	�)test_call_on_defined_sealed_mock_succeedsOs
z6TestSealable.test_call_on_defined_sealed_mock_succeedsc	Csvt��}d|j��_t�|�|�|j��jd�|�t��|j��j	WdQRX|�t��|jjWdQRXdS)N�)
rr�test1rrrrrr�test4)rrrrr	�&test_seals_recurse_on_added_attributesUs
z3TestSealable.test_seals_recurse_on_added_attributesc	Cs�t��}d|jjd_d|jjdd�_t�|�|�|jjdjd�|�|jjdd�jd�|�t��|jjdj	WdQRX|�t��|jjdd�j	WdQRXdS)Nr(�arr&)
rZ	MagicMockr)rrrrrrr*)rrrrr	�#test_seals_recurse_on_magic_methodsas
z0TestSealable.test_seals_recurse_on_magic_methodscCsZtjdd�}tjdd�|j_d|jj_t�|�|�|jjjd�|jjjd|jj_dS)NZ	root_mock)�nameZ
not_sealedr(r)rrr)rrrrr*)rrrrr	�,test_seals_dont_recurse_on_manual_attributesos


z9TestSealable.test_seals_dont_recurse_on_manual_attributesc	Cs\t�t�}d|_d|_t�|�|�|jd�|�|jd�|�t��|j	WdQRXdS)Nrr )
rrrrZattr_sample3rrrrr)rrrrr	�)test_integration_with_spec_att_definitionzs

z6TestSealable.test_integration_with_spec_att_definitionc	CsNt�t�}d|j_t�|�|�|��d�|�t��|�	�WdQRXdS)Nr)
rrrrr!rrrrr)rrrrr	�,test_integration_with_spec_method_definition�s

z9TestSealable.test_integration_with_spec_method_definitionc	Cs,t�t�}|�t��d|j_WdQRXdS)Nr )rrrrrZmethod_sample3r!)rrrrr	�:test_integration_with_spec_method_definition_respects_spec�s
zGTestSealable.test_integration_with_spec_method_definition_respects_specc	CsDt��}t�|�|�t��}|jWdQRX|�dt|j��dS)N�SECRETE_name)	rrrrrr3�assertIn�str�	exception)rr�cmrrr	�(test_sealed_exception_has_attribute_name�s

z5TestSealable.test_sealed_exception_has_attribute_namec	Cs\tjdd�}|jjjjt�|�|�t��}|jjjjj	WdQRX|�
dt|j��dS)NZ	mock_name)r.z&mock_name.test1.test2.test3.test4.boom)
rrr)rrr*rrrZboomr4r5r6)rrr7rrr	�"test_attribute_chain_is_maintained�s
z/TestSealable.test_attribute_chain_is_maintainedc	Cs`t��}|��j��jt�|�|�t��}|��j����WdQRX|�	dt
|j��dS)Nz mock.test1().test2.test3().test4)rrr)rrr*rrrr4r5r6)rrr7rrr	�test_call_chain_is_maintained�s
z*TestSealable.test_call_chain_is_maintainedN)r
rrrrrrrr"r$r%r'r+r-r/r0r1r2r8r9r:rrrr	rs$	
	r�__main__)ZunittestrrZTestCaserr
�mainrrrr	�<module>s$