
    <e                        	 d dl Z d dlmZ d dlZd dlZd dlZd dlmZ  ej        d           dZ	dZ
 ej                    Z G d d	ej                  Z G d
 dej                  Zedk    r ej                     dS dS )    N)threading_helper)	print_excT)module   2   c                       e Zd ZdZdZd ZdS )TempFileGreedyr   c                 `   t          j                    | _        t                                           t          t                    D ]g}	 t          j        d          }|	                                 | xj
        dz  c_
        <#  | xj        dz  c_        t          | j                   Y exY wd S )Nzw+b   )file)ioStringIOerrors
startEventwaitrangeFILES_PER_THREADtempfileTemporaryFilecloseok_counterror_countr   )selfifs      1/usr/lib/python3.11/test/test_threadedtempfile.pyrunzTempFileGreedy.run%   s    kmm'(( 	# 	#A#*511			
 "	,  A%  t{++++++	# 	#s   	(B'B+N)__name__
__module____qualname__r   r   r        r   r	   r	   !   s-        KH# # # # #r"   r	   c                       e Zd Zd ZdS )ThreadedTempFileTestc                    d t          t                    D             }t          j        |t          j                  5  	 d d d            n# 1 swxY w Y   t          d |D                       }d |D             }dt          |          |d                    |          fz  }| 	                    |g |           | 	                    |t          t          z             d S )Nc                 *    g | ]}t                      S r!   )r	   ).0r   s     r   
<listcomp>z2ThreadedTempFileTest.test_main.<locals>.<listcomp>5   s    @@@>##@@@r"   c              3   $   K   | ]}|j         V  d S )N)r   r'   ts     r   	<genexpr>z1ThreadedTempFileTest.test_main.<locals>.<genexpr>8   s$      --------r"   c                     g | ]D}|j         	t          |j                  t          |j                                                  z   ES r!   )r   strnamer   getvaluer*   s     r   r(   z2ThreadedTempFileTest.test_main.<locals>.<listcomp>9   sQ     5 5 5am5#af++AH$5$5$7$7 8 88 5 5 5r"   zErrors: errors %d ok %d
%s
)r   NUM_THREADSr   start_threadsr   setsumlenjoinassertEqualr   )r   threadsokr   msgs        r   	test_mainzThreadedTempFileTest.test_main4   s(   @@U;-?-?@@@+GZ^DD 	 		 	 	 	 	 	 	 	 	 	 	 	 	 	 	--W-----5 5"5 5 5 ,s6{{BIIf/ S)))[+;;<<<<<s   AAAN)r   r   r    r<   r!   r"   r   r$   r$   3   s#        = = = = =r"   r$   __main__)r   test.supportr   unittestr   	threading	tracebackr   requires_working_threadingr2   r   Eventr   Threadr	   TestCaser$   r   mainr!   r"   r   <module>rG      s
    ) ) ) ) ) )  				           +  +4 8 8 8 8  Y_
# # # # #Y% # # #$= = = = =8, = = = zHMOOOOO r"   