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/test/__pycache__/test_threading_local.cpython-37.pyc
B

��gZ�@s�ddlZddlZddlmZddlmZddlZddlZddlZddl	Z	ddl
Z
Gdd�de�Zdd�Z
Gdd	�d	�ZGd
d�deje�ZGdd
�d
eje�Zdd�Zedkr�e�dS)�N)�DocTestSuite)�supportc@seZdZdS)�WeakN)�__name__�
__module__�__qualname__�rr�5/usr/local/lib/python3.7/test/test_threading_local.pyrsrcCs t�}||_|�t�|��dS)N)r�weak�append�weakref�ref)�local�weaklistr
rrr	�targetsrc@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�
BaseLocalTestcCs"|�d�|�d�|�d�dS)N��2�d)�_local_refs)�selfrrr	�test_local_refss

zBaseLocalTest.test_local_refscCs�|��}g}x2t|�D]&}tjt||fd�}|��|��qW~t��|�	t
|�|�dd�|D�}|�t
|�|d|f�d|_t��dd�|D�}|�t
|�|d|f|t
|�f�dS)N)r�argscSsg|]}|�dkr|�qS)Nr)�.0r
rrr	�
<listcomp>+sz-BaseLocalTest._local_refs.<locals>.<listcomp>�cSsg|]}|�dkr|�qS)Nr)rr
rrr	r1s)
�_local�range�	threading�Threadr�start�join�gc�collect�assertEqual�lenZassertInZsomeothervar)r�nrr�i�tZdeadlistrrr	rszBaseLocalTest._local_refsc	s^ddl�G�fdd�d�j�}|����fdd��t��fdd�td�D���WdQRXdS)	NrcseZdZ�fdd�ZdS)z)BaseLocalTest.test_derived.<locals>.Localcs��d�dS)Ng{�G�z�?)Zsleep)r)�timerr	�__init__;sz2BaseLocalTest.test_derived.<locals>.Local.__init__N)rrrr*r)r)rr	�Local:sr+cs|�_���j|�dS)N)�xr$)r')rrrr	�f?sz%BaseLocalTest.test_derived.<locals>.fc3s|]}tj�|fd�VqdS))rrN)rr)rr')r-rr	�	<genexpr>Dsz-BaseLocalTest.test_derived.<locals>.<genexpr>�
)r)rrZ
start_threadsr)rr+r)r-rrr)r	�test_derived4szBaseLocalTest.test_derivedcs�Gdd�d|j��d�d�t���t��������fdd�}tj|d�}|������fdd�td	�D�����|��|�	��dS)
Nc@seZdZdS)z7BaseLocalTest.test_derived_cycle_dealloc.<locals>.LocalN)rrrrrrr	r+Jsr+FcsL��g}|�|�d|d_~t��������tdd��D���dS)N�barrcss|]}t|d�VqdS)�fooN)�hasattr)rrrrr	r.`szFBaseLocalTest.test_derived_cycle_dealloc.<locals>.f.<locals>.<genexpr>)rr2r"r#�set�wait�all)�cycle)r+�e1�e2�locals�passedrr	r-Qs

z3BaseLocalTest.test_derived_cycle_dealloc.<locals>.f)rcsg|]
}���qSrr)rr')r+rr	risz<BaseLocalTest.test_derived_cycle_dealloc.<locals>.<listcomp>r/)
rr�Eventrr r5rr4r!Z
assertTrue)rr-r(r)r+r8r9r:r;r	�test_derived_cycle_deallocHsz(BaseLocalTest.test_derived_cycle_dealloccCsJGdd�d|j�}|dd�|d�|jt|jdd�|�t|jd�dS)Nc@seZdZdd�ZdS)z-BaseLocalTest.test_arguments.<locals>.MyLocalc_sdS)Nr)rr�kwargsrrr	r*rsz6BaseLocalTest.test_arguments.<locals>.MyLocal.__init__N)rrrr*rrrr	�MyLocalqsr?r)�a)r�assertRaises�	TypeError)rr?rrr	�test_argumentsos

zBaseLocalTest.test_argumentscs�d�_���t���t������fdd�}���fdd�}tj|d�}|�����tj|d�}|��|�����|�����j�j�dS)Nz No error message set or cleared.cs$d�_d�_�`������dS)Nr2r1)r,�yr4r5r)r8r9�objrr	�f1�s
z)BaseLocalTest._test_one_class.<locals>.f1csFy
�j}Wntk
r$d�_YnXd|�f�_tj��j�dS)N�z'Incorrectly got value %r from class %r
)r,�AttributeError�_failed�sys�stderr�write)r2)�crErrr	�f2�s
z)BaseLocalTest._test_one_class.<locals>.f2)r)	rIrr<rr r5r!r4ZassertFalse)rrMrFrNZt1Zt2r)rMr8r9rErr	�_test_one_classzszBaseLocalTest._test_one_classcCs|�|j�dS)N)rOr)rrrr	�test_threading_local�sz"BaseLocalTest.test_threading_localcCs Gdd�d|j�}|�|�dS)Nc@seZdZdZdS)zBBaseLocalTest.test_threading_local_subclass.<locals>.LocalSubclassz(To test that subclasses behave properly.N)rrr�__doc__rrrr	�
LocalSubclass�srR)rrO)rrRrrr	�test_threading_local_subclass�sz+BaseLocalTest.test_threading_local_subclassc	CsX|�}d|_|�|jddi�|�t��i|_WdQRX|�t��
|`WdQRXdS)N�r,)r,r$�__dict__rArH)r�clsrErrr	�_test_dict_attribute�sz"BaseLocalTest._test_dict_attributecCs|�|j�dS)N)rWr)rrrr	�test_dict_attribute�sz!BaseLocalTest.test_dict_attributecCs Gdd�d|j�}|�|�dS)Nc@seZdZdZdS)zABaseLocalTest.test_dict_attribute_subclass.<locals>.LocalSubclassz(To test that subclasses behave properly.N)rrrrQrrrr	rR�srR)rrW)rrRrrr	�test_dict_attribute_subclass�sz*BaseLocalTest.test_dict_attribute_subclasscCsJGdd�d�}|�}|��|_||j_t�|�}~t��|�|��dS)Nc@seZdZdS)z.BaseLocalTest.test_cycle_collection.<locals>.XN)rrrrrrr	�X�srZ)rrr,rr
r"r#ZassertIsNone)rrZr,Zwrrrr	�test_cycle_collection�s

z#BaseLocalTest.test_cycle_collectionN)rrrrrr0r=rCrOrPrSrWrXrYr[rrrr	rs'$	rc@seZdZejZdS)�ThreadLocalTestN)rrr�_threadrrrrr	r\�sr\c@seZdZejZdS)�PyThreadingLocalTestN)rrr�_threading_localrrrrrr	r^�sr^csrt��}|�td��|�t�t��|�t�t��tj�dd�}�fdd�}|�td||d��t	�
|�dS)Nr_cSstjt_dS)N)r]rr_r)�testrrr	�setUp�sztest_main.<locals>.setUpcs
�t_dS)N)r_r)r`)�
local_origrr	�tearDown�sztest_main.<locals>.tearDown)rarc)�unittestZ	TestSuiteZaddTestrZ	makeSuiter\r^r_rrZrun_unittest)Zsuiterarcr)rbr	�	test_main�sre�__main__)rJrdZdoctestrr`rrr"r]rr_�objectrrrZTestCaser\r^rerrrrr	�<module>s".