o
    ÑtPf¾G  ã                   @   s&  d dl m Z  d dlZd dlZd dlmZ d dlmZ d dlmZ	 d dl
Zd dlZd dlmZ d dlZG dd„ dejƒZdd	„ ZG d
d„ deƒZG dd„ de	jƒZG dd„ deƒZd;dd„Zdd„ Zdd„ Zdd„ Zd\ZZZdZdZe	jrxe	js~e	j s~e	j!rdZne	j"s‡e	j#r‰dZG dd„ de	jƒZ$e	j%G d d!„ d!e$ƒƒZ&e	j%G d"d#„ d#e$ƒƒZ'e	j%G d$d%„ d%e$ƒƒZ(G d&d'„ d'e$ƒZ)G d(d)„ d)e	jƒZ*G d*d+„ d+ejj+j,ƒZ-G d,d-„ d-ejj+j,ƒZ.G d.d/„ d/e	jƒZ/G d0d1„ d1e	jƒZ0d2d3„ Z1G d4d5„ d5e	jƒZ2d6d7„ Z3G d8d9„ d9e	jƒZ4e5d:kre	 6¡  dS dS )<é    )ÚtimeN)ÚEvent)ÚQueue©ÚExpectedExceptionc                   @   s\   e Zd ZejjZdd„ Zdd„ Zdd„ Z	de	_
dd	„ Zd
d„ Zdd„ Ze d¡dd„ ƒZdS )ÚTestCoroutinePoolc                    s4   t ƒ ‰ ‡ fdd„}|  d¡}| |d¡ ˆ  ¡  d S )Nc                    s   ˆ   ¡  d S ©N)Úset©Ú_©Údone© úX/var/www/html/humari/django-venv/lib/python3.10/site-packages/gevent/tests/test__pool.pyÚ	some_work   s   z5TestCoroutinePool.test_apply_async.<locals>.some_worké   ©Úx)r   ÚklassÚapply_asyncÚwait©Úselfr   Úpoolr   r   r   Útest_apply_async   s
   
z"TestCoroutinePool.test_apply_asyncc                    s4   d‰ ‡ fdd„}|   d¡}| |¡}|  ˆ |¡ d S )Nzreturn valuec                      s   ˆ S r   r   r   ©Úvaluer   r   r      s   z/TestCoroutinePool.test_apply.<locals>.some_workr   ©r   ÚapplyÚassertEqual)r   r   r   Úresultr   r   r   Ú
test_apply   s
   

zTestCoroutinePool.test_applyc                 C   sD   |   d¡}dd„ }z| |¡ W n
 ty   Y d S w |  d¡ d S )Né   c                   S   s   t ƒ ‚r   r   r   r   r   r   Úraiser)   s   z3TestCoroutinePool.test_apply_raises.<locals>.raiserz$Should have raised ExpectedException)r   r   r   Úfail)r   r   r#   r   r   r   Útest_apply_raises&   s   
ÿz#TestCoroutinePool.test_apply_raisesFc                    s`   t ƒ ‰ g ‰‡ ‡fdd„}‡ ‡fdd„}|  d¡}| |¡}| |¡ | ¡  |  g d¢ˆ¡ d S )Nc                      s    t  d¡ ˆ d¡ ˆ  ¡  d S )Nçü©ñÒMbP?Úprod)ÚgeventÚsleepÚappendr	   r   ©ÚevtÚresultsr   r   Úproducer:   s   

z7TestCoroutinePool.test_multiple_coros.<locals>.producerc                      s    ˆ  d¡ ˆ  ¡  ˆ  d¡ d S )NÚcons1Úcons2)r*   r   r   r+   r   r   Úconsumer?   s   
z7TestCoroutinePool.test_multiple_coros.<locals>.consumerr   )r/   r'   r0   )r   r   Úspawnr   Úgetr   )r   r.   r1   r   r   r   r+   r   Útest_multiple_coros6   s   


z%TestCoroutinePool.test_multiple_corosc                    sJ   g ‰‡fdd„‰ ‡ fdd„}|   d¡}| |¡ t d¡ |  ˆg ¡ d S )Nc                      s   ˆ   d¡ d S )NT)r*   r   )Útimer_firedr   r   Ú
fire_timerM   ó   z<TestCoroutinePool.dont_test_timer_cancel.<locals>.fire_timerc                      s   t  dˆ ¡ d S )Nr   )r(   Útimerr   )r6   r   r   r   P   s   z;TestCoroutinePool.dont_test_timer_cancel.<locals>.some_workr   r   )r   r   r(   r)   r   r   r   )r6   r5   r   Údont_test_timer_cancelJ   s   


z(TestCoroutinePool.dont_test_timer_cancelc                 C   sJ   |   d¡}| |jdd„ df¡}|  |d¡ tƒ }| |j¡ | ¡  d S )Nr"   c                 S   s   | d S )Nr"   r   ©Úar   r   r   Ú<lambda>Z   ó    z2TestCoroutinePool.test_reentrant.<locals>.<lambda>©é   é   )r   r   r   r   r   r	   r   )r   r   r    r,   r   r   r   Útest_reentrantX   s   
z TestCoroutinePool.test_reentrantzDoes not work on PyPyc                 C   sò   dd l }| jdd}|j}zctƒ |_| t¡}t d¡ |  t	|j
¡ W d   ƒ n1 s.w   Y  t d¡ |  | ¡ d¡ tj d¡ | tjd¡ W d   ƒ n1 sXw   Y  W ||_| ¡  d S W ||_| ¡  d S ||_| ¡  w )Nr   r"   ©Úsizer   çš™™™™™¹?)r   )Úsysr   ÚstderrÚFakeFiler2   Úcrashr(   ÚTimeoutÚassertRaisesÚRuntimeErrorr3   r)   r   Ú
free_countÚ	start_newr   Újoin)r   rE   r   Ú
normal_errÚwaiterr   r   r   Útest_stderr_raising`   s*   
ú
ÿüÿ
z%TestCoroutinePool.test_stderr_raisingN)Ú__name__Ú
__module__Ú__qualname__r(   r   ÚPoolr   r   r!   r%   Úerror_fatalr4   r9   rA   Ú	greentestÚ
skipOnPyPyrQ   r   r   r   r   r      s    

r   c                  O   ó   t dƒ‚)Nz*Raising an error from the crash() function©rK   )Ú_argsÚ_kwr   r   r   rH   …   ó   rH   c                   @   ó   e Zd Zdd„ ZdS )rG   c                 G   rY   )NzWriting to the file failedrZ   )r   r[   r   r   r   Úwrite‹   r]   zFakeFile.writeN)rR   rS   rT   r_   r   r   r   r   rG   ‰   ó    rG   c                   @   sf   e Zd ZejjZdd„ Zdd„ Zdd„ Z	e
jdd„ ƒZe
jd	d
„ ƒZe
jdd„ ƒZdd„ Zdd„ ZdS )ÚPoolBasicTestsc                 C   s  | j dd}|  | ¡ d¡ g }| |jd¡}|  | ¡ d¡ | ¡  |  |dg¡ t d¡ |  | ¡ d¡ | |jd¡ |  d| ¡ ¡ |  |dg¡ | |jd¡ |  d| ¡ ¡ |  |dg¡ | |jd¡ |  |dg¡ t d¡ |  t	|ƒg d	¢¡ d S )
Nr   rB   r"   r   )r   )é   )é   ç{®Gáz„?)r"   r   rb   rc   )
r   r   rL   r2   r*   r3   r(   r)   r   Úsorted)r   ÚpÚrÚfirstr   r   r   Útest_execute_async’   s&   

z!PoolBasicTests.test_execute_asyncc                 C   sZ   | j dd}| tjd¡}| |¡ | ¡  |  |¡ |  t|ƒd¡ |  |j	j
d¡ d S )Nr"   rB   éè  r   )r   r2   r(   r)   ÚdiscardÚkillÚassertFalser   ÚlenÚ
_semaphoreÚcounter)r   rf   rh   r   r   r   Útest_discard­   s   

zPoolBasicTests.test_discardc              	   C   s$  | j dd}t tjd¡}zt tjd¡}zk|  | ¡ d¡ |  t|ƒd¡ | |¡ |  | ¡ d¡ |  t|ƒd¡ |  tj	¡" t 	d¡ | |¡ W d   ƒ n1 sWw   Y  W d   ƒ n1 sfw   Y  |  | ¡ d¡ |  t|ƒd¡ W | 
¡  n| 
¡  w W | 
¡  d S | 
¡  w )Nr"   rB   rj   r   rD   )r   r(   r2   r)   r   rL   rn   ÚaddrJ   rI   rl   ©r   rf   rh   Úsecondr   r   r   Útest_add_method¶   s(   
ÿ€ÿzPoolBasicTests.test_add_methodc                 C   ó    | j dd}t tjd¡}z=t tjd¡}z)| |¡ |  tjj¡ |j|dd W d   ƒ n1 s4w   Y  W | ¡  n| ¡  w W | ¡  d S | ¡  w )Nr"   rB   rj   F)Úblocking©	r   r(   r2   r)   rr   rJ   r   ÚPoolFullrl   rs   r   r   r   Útest_add_method_non_blockingÍ   ó   
ÿ€z+PoolBasicTests.test_add_method_non_blockingc                 C   rv   ©Nr"   rB   rj   rD   ©Útimeoutrx   rs   r   r   r   Útest_add_method_timeoutÜ   r{   z&PoolBasicTests.test_add_method_timeoutc                 C   s    | j dd}t tjd¡}z=t tjd¡}z)| |¡ |  tjj¡ |j	|dd W d   ƒ n1 s4w   Y  W | 
¡  n| 
¡  w W | 
¡  d S | 
¡  w r|   )r   r(   r2   r)   ÚGreenletrr   rJ   r   ry   Ústartrl   rs   r   r   r   Útest_start_method_timeoutë   r{   z(PoolBasicTests.test_start_method_timeoutc                 C   s(   |   ¡ }| dd„ d¡}|  |d¡ d S )Nc                 S   s   d| fS )NÚfoor   r:   r   r   r   r<   ü   r=   z+PoolBasicTests.test_apply.<locals>.<lambda>)r"   )rƒ   r"   r   )r   rf   r    r   r   r   r!   ú   s   zPoolBasicTests.test_applyc                 C   s   d| _ |  t| jd¡ d S )NFéÿÿÿÿ)Úswitch_expectedrJ   Ú
ValueErrorr   ©r   r   r   r   Útest_init_errorÿ   s   zPoolBasicTests.test_init_errorN)rR   rS   rT   r(   r   rU   r   ri   rq   ru   rW   Úignores_leakcheckrz   r   r‚   r!   rˆ   r   r   r   r   ra      s    	


ra   c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚTimingWrapperc                 C   s   || _ d | _d S r   )ÚfuncÚelapsed)r   r‹   r   r   r   Ú__init__	  s   
zTimingWrapper.__init__c                 O   s4   t ƒ }z| j|i |¤ŽW t ƒ | | _S t ƒ | | _w r   )r   r‹   rŒ   )r   ÚargsÚkwdsÚtr   r   r   Ú__call__  s   zTimingWrapper.__call__N)rR   rS   rT   r   r‘   r   r   r   r   rŠ     s    rŠ   ç        c                 C   s   t  |¡ | |  S r   )r(   r)   )r   r   r   r   r   Úsqr  s   
r“   c                 C   s   | |  S r   r   r   r   r   r   Úsquared  r]   r”   c                 C   s   t  t ¡ d ¡ | |  S )NrD   )r(   r)   Úrandomr   r   r   r   Úsqr_random_sleep  ó   r–   c                  c   s$    t dƒD ]} | V  qt d¡ d S )Nrb   çš™™™™™É?)Úranger(   r)   )Úir   r   r   Úfinal_sleep#  s   €r›   )gË¡E¶óý´?gìQ¸…ë¡?gìQ¸…ëÁ?é
   rj   é   éd   c                   @   sÖ   e Zd ZejZdZdd„ Zdd„ Zdd„ Z	dd	„ Z
d
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Zd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2S )3ÚTestPoolr"   c                 C   s    t j | ¡ tj | j¡| _d S r   )rW   ÚTestCaseÚsetUpr(   r   rU   rC   r‡   r   r   r   r¡   9  s   zTestPool.setUpc                 C   s   | j  ¡  d S r   )r   rN   r‡   r   r   r   Úcleanup=  r7   zTestPool.cleanupc                 C   s6   | j j}|  |tdƒd¡ |  |tdddiƒd¡ d S )Nr>   r   r   r   rb   é	   )r   r   r   r“   )r   Úpapplyr   r   r   r!   @  s   zTestPool.test_applyc                 C   sT   | j j}|  |tttƒƒtttttƒƒƒ¡ |  |ttdƒƒttttdƒƒƒ¡ d S )Nrž   )r   Úmapr   r“   r™   ÚSMALL_RANGEÚlistr”   )r   Úpmapr   r   r   Útest_mapE  s   $(zTestPool.test_mapc                 C   s>   | j  tdtf¡}t|jƒ}|  |ƒ d¡ |  |jtd¡ d S )Né   é1   r"   )	r   r   r“   ÚTIMEOUT1rŠ   r3   r   ÚassertTimeoutAlmostEqualrŒ   ©r   Úresr3   r   r   r   Ú
test_asyncJ  s   
zTestPool.test_asyncc                 C   s`   g }| j jtdtf|jd}t|jƒ}|  |ƒ d¡ |  |j	td¡ t
 d¡ |  |dg¡ d S )Nrª   )Úcallbackr«   r"   r   )r   r   r“   r¬   r*   rŠ   r3   r   r­   rŒ   r(   r)   )r   r    r¯   r3   r   r   r   Útest_async_callbackP  s   

zTestPool.test_async_callbackc                 C   sP   | j  tdtd f¡}t|jƒ}| jtj|td |  	|j
td¡ | j  ¡  d S )Nr@   r˜   r}   r"   )r   r   r“   ÚTIMEOUT2rŠ   r3   rJ   r(   rI   r­   rŒ   rN   r®   r   r   r   Útest_async_timeoutY  s
   
zTestPool.test_async_timeoutc                 C   s4   | j  tttƒ¡}|  t|ƒtttttƒƒƒ¡ d S r   )r   Úimapr“   r™   r¦   r   r§   r¥   ©r   Úitr   r   r   Útest_imap_list_small`  ó   "zTestPool.test_imap_list_smallc                 C   óF   | j  tttƒ¡}ttƒD ]}|  t|ƒ|| ¡ q|  tt|¡ d S r   )	r   rµ   r“   r™   r¦   r   ÚnextrJ   ÚStopIteration©r   r·   rš   r   r   r   Útest_imap_it_smalld  ó   zTestPool.test_imap_it_smallc                 C   rº   r   )	r   rµ   r“   r™   ÚLARGE_RANGEr   r»   rJ   r¼   r½   r   r   r   Útest_imap_it_largej  r¿   zTestPool.test_imap_it_largec                 C   s4   | j  tttƒ¡}|  t|ƒtttttƒƒƒ¡ d S r   )	r   rµ   r–   r™   r¦   r   r§   r¥   r”   r¶   r   r   r   Útest_imap_randomp  r¹   zTestPool.test_imap_randomc                 C   sd   | j  tttƒ¡}|  t|ƒttt	ttƒƒƒ¡ | j  tttƒ¡}|  t|ƒttt	ttƒƒƒ¡ d S r   )
r   Úimap_unorderedr“   r™   rÀ   r   re   r§   r¥   r”   r¶   r   r   r   Útest_imap_unorderedt  s   "zTestPool.test_imap_unorderedc                 C   s4   | j  tttƒ¡}|  t|ƒttt	ttƒƒƒ¡ d S r   )
r   rÃ   r–   r™   r¦   r   re   r§   r¥   r”   r¶   r   r   r   Útest_imap_unordered_random{  r¹   z#TestPool.test_imap_unordered_randomc                 C   ó"   | j  tg ¡}|  t|ƒg ¡ d S r   )r   rÃ   r“   r   r§   r¶   r   r   r   Útest_empty_imap_unordered  ó   z"TestPool.test_empty_imap_unorderedc                 C   rÆ   r   )r   rµ   r“   r   r§   r¶   r   r   r   Útest_empty_imapƒ  rÈ   zTestPool.test_empty_imapc                 C   s   |   | j tg ¡g ¡ d S r   )r   r   r¥   r“   r‡   r   r   r   Útest_empty_map‡  s   zTestPool.test_empty_mapc                 C   sX   | j  tjdg| jpdd  ¡}t d¡ t| j jƒ}|ƒ  |  |jdd¡ | 	¡  d S )NrD   rœ   r   r’   ç      à?)
r   Ú	map_asyncr(   r)   rC   rŠ   rl   ÚassertTimeWithinRangerŒ   rN   )r   r    rl   r   r   r   Útest_terminateŠ  s    
zTestPool.test_terminatec                 C   s   t  t|ƒd ¡ t|ƒS )Ng      $@)r(   r)   ÚfloatÚstr)r   r   r   r   r   r)   ’  r—   zTestPool.sleepc                 C   sF   t | j | jg d¢¡ƒ}| jjdkrg d¢}ng d¢}|  ||¡ d S )N)rœ   r"   r   r"   )Ú10Ú1Ú2)rÒ   rÓ   rÑ   )r§   r   rÃ   r)   rC   r   )r   r    Úexpectedr   r   r   Útest_imap_unordered_sleep–  s
   
z"TestPool.test_imap_unordered_sleepc                 C   óH   t ƒ }| d¡ t d|jt¡ t| j dd„ |¡ƒ}|  |dg¡ d S )Né{   rD   c                 S   ó   | S r   r   r
   r   r   r   r<   ¤  ó    z,TestPool.test_imap_no_stop.<locals>.<lambda>)	r   Úputr(   Úspawn_laterr¼   r§   r   rµ   r   ©r   Úqr    r   r   r   Útest_imap_no_stop   ó
   
zTestPool.test_imap_no_stopc                 C   rÖ   )NiÒ  rD   c                 S   rØ   r   r   r
   r   r   r   r<   «  rÙ   z6TestPool.test_imap_unordered_no_stop.<locals>.<lambda>)	r   rÚ   r(   rÛ   r¼   r§   r   rÃ   r   rÜ   r   r   r   Útest_imap_unordered_no_stop§  rß   z$TestPool.test_imap_unordered_no_stopc                 C   ó(   t | j ttƒ ¡ƒ}|  |g d¢¡ d S ©N)r   r"   rc   )r§   r   rµ   r“   r›   r   ©r   r    r   r   r   Útest_imap_final_sleep¯  ó   zTestPool.test_imap_final_sleepc                 C   rá   râ   )r§   r   rÃ   r“   r›   r   rã   r   r   r   Útest_imap_unordered_final_sleep³  rå   z(TestPool.test_imap_unordered_final_sleepc                    s|   t tdƒƒ}dg‰ ‡ fdd„}‡ ‡fdd„}ˆjjˆjjfD ]}dˆ d< ||||dd}||ƒ}|ƒ }ˆ t|ƒ|¡ qd S )	Nrž   r   c                    s   ˆ d  d7  < | S )Nr   r"   r   )rš   Ú_j)Úrunningr   r   Úshort_running_func½  s   zFTestPool.test_imap_unordered_bounded_queue.<locals>.short_running_funcc                    s   ‡ ‡‡fdd„}|S )Nc                     sf   g } t ˆ ƒD ]*\}}ˆ ˆd |d kˆd ¡ |  |¡ t d¡ ˆ tˆ jƒdktˆ jƒ¡ q| S )Nr   r   rd   )Ú	enumerateÚ
assertTruer*   r(   r)   rn   Úqueue)r    rš   r   )Úmappingrè   r   r   r   ÚreaderÄ  s   

zOTestPool.test_imap_unordered_bounded_queue.<locals>.make_reader.<locals>.readerr   )rí   rî   ©rè   r   )rí   r   Úmake_readerÁ  s   z?TestPool.test_imap_unordered_bounded_queue.<locals>.make_readerr"   )Úmaxsize)r§   r™   r   rÃ   rµ   r   re   )r   Úiterableré   rð   Úmethrí   rî   Úlr   rï   r   Ú!test_imap_unordered_bounded_queue¸  s   ÿùz*TestPool.test_imap_unordered_bounded_queueN)rR   rS   rT   rW   ÚLARGE_TIMEOUTÚ__timeout__rC   r¡   r¢   r!   r©   r°   r²   r´   r¸   r¾   rÁ   rÂ   rÄ   rÅ   rÇ   rÉ   rÊ   rÎ   r)   rÕ   rÞ   rà   rä   ræ   rõ   r   r   r   r   rŸ   5  s6    	
rŸ   c                   @   ó   e Zd ZdZdS )Ú	TestPool2r   N©rR   rS   rT   rC   r   r   r   r   rù   Ù  ó    rù   c                   @   rø   )Ú	TestPool3rb   Nrú   r   r   r   r   rü   Ý  rû   rü   c                   @   rø   )Ú
TestPool10rœ   Nrú   r   r   r   r   rý   á  rû   rý   c                   @   s   e Zd ZdZdS )ÚTestPoolUnlimitNrú   r   r   r   r   rþ   æ  s    rþ   c                   @   ó   e Zd ZdZdd„ ZdS )Ú	TestPool0r   c                 C   sD   t jjdd}|  d| ¡ ¡ |  | ¡ ¡ |  d|jdd¡ d S )Nr   rB   rd   r}   )r(   r   rU   r   rL   rë   ÚfullÚwait_available©r   rf   r   r   r   Útest_wait_fullí  s   zTestPool0.test_wait_fullN)rR   rS   rT   rC   r  r   r   r   r   r   ê  ó    r   c                   @   r^   )ÚTestJoinSleepc                 C   s>   t j ¡ }| t jd¡}z|j|d W | ¡  d S | ¡  w )Nrœ   r}   ©r(   r   rU   r2   r)   rN   rl   ©r   r~   rf   Úgr   r   r   r   ö  s
   
zTestJoinSleep.waitN©rR   rS   rT   r   r   r   r   r   r  ô  r`   r  c                   @   r^   )ÚTestJoinSleep_raise_errorc                 C   s@   t j ¡ }| t jd¡}z|j|dd W | ¡  d S | ¡  w )Nrœ   T)r~   Úraise_errorr  r  r   r   r   r     s
   
zTestJoinSleep_raise_error.waitNr
  r   r   r   r   r  ÿ  r`   r  c                   @   rÿ   )ÚTestJoinEmptyFc                 C   s"   t j ¡ }| ¡ }|  |d¡ d S )Nzempty should return true)r(   r   rU   rN   rë   ©r   rf   r¯   r   r   r   Útest  s   
zTestJoinEmpty.testN)rR   rS   rT   r…   r  r   r   r   r   r  
  r  r  c                   @   ó    e Zd ZdZdd„ Zdd„ ZdS )Ú	TestSpawnTc                 C   s€   t j d¡}|  t|ƒd¡ | t jd¡ |  t|ƒd¡ | t jd¡ |  t|ƒd¡ t  tjs3dnd¡ |  t|ƒd¡ d S )Nr"   r   rD   gR¸…ëQÈ?rË   )	r(   r   rU   r   rn   r2   r)   rW   ÚEXPECT_POOR_TIMER_RESOLUTIONr  r   r   r   r    s   zTestSpawn.testc                 C   sx   t j d¡}|  t|ƒd¡ | t jd¡ |  t|ƒd¡ | d¡}|  |d¡ | ¡ }|  	|d¡ |  t|ƒd¡ d S )Nr"   r   rD   rd   z*waiting on a full pool should return falsez waiting to finish should be true)
r(   r   rU   r   rn   r2   r)   rN   rm   rë   r  r   r   r   ÚtestSpawnAndWait   s   
zTestSpawn.testSpawnAndWaitN)rR   rS   rT   r…   r  r  r   r   r   r   r    s    
r  c                   c   s    dV  dV  t ‚)Nr"   r   r   r   r   r   r   Ú
error_iter+  s   €r  c                   @   r  )ÚTestErrorInIteratorFc                 C   s2   t j d¡}|  t|jdd„ tƒ ¡ t  d¡ d S )Nrb   c                 S   ó   d S r   r   r   r   r   r   r<   6  rÙ   z*TestErrorInIterator.test.<locals>.<lambda>r&   )r(   r   rU   rJ   r   r¥   r  r)   r  r   r   r   r  4  s   zTestErrorInIterator.testc                    s2   t j d¡‰ ‡ fdd„}|  t|¡ t  d¡ d S )Nrb   c                      s   t ˆ  dd„ tƒ ¡ƒS )Nc                 S   r  r   r   r   r   r   r   r<   =  rÙ   zGTestErrorInIterator.test_unordered.<locals>.unordered.<locals>.<lambda>)r§   rÃ   r  r   ©rf   r   r   Ú	unordered<  s   z5TestErrorInIterator.test_unordered.<locals>.unorderedr&   )r(   r   rU   rJ   r   r)   )r   r  r   r  r   Útest_unordered9  s   z"TestErrorInIterator.test_unorderedN)rR   rS   rT   rV   r  r  r   r   r   r   r  1  s    r  c                 C   s   d|  S )Nç      ð?r   r   r   r   r   Ú	divide_byC  r]   r  c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚTestErrorInHandlerFc                 C   s&   t j d¡}|  t|jtg d¢¡ d S )Nrb   ©r"   r   r   )r(   r   rU   rJ   ÚZeroDivisionErrorr¥   r  r  r   r   r   r©   J  s   zTestErrorInHandler.test_mapc                 C   ó\   t j d¡}| tg d¢¡}|  t|ƒd¡ |  tt|¡ |  t|ƒd¡ |  t	t|¡ d S ©Nr"   r  r  rË   )
r(   r   rU   rµ   r  r   r»   rJ   r  r¼   ©r   rf   r·   r   r   r   Ú	test_imapN  ó   zTestErrorInHandler.test_imapc                 C   r  r   )
r(   r   rU   rÃ   r  r   r»   rJ   r  r¼   r!  r   r   r   rÄ   V  r#  z&TestErrorInHandler.test_imap_unorderedN)rR   rS   rT   rV   r©   r"  rÄ   r   r   r   r   r  G  s
    r  Ú__main__)r’   )7r   r(   Úgevent.poolÚgevent.eventr   Úgevent.queuer   Úgevent.testingÚtestingrW   Úgevent.testing.timingr•   r   Úunittestr    r   rH   ÚobjectrG   ra   rŠ   r“   r”   r–   r›   r¬   r³   ÚTIMEOUT3r¦   rÀ   ÚPYPYÚWINÚRUN_LEAKCHECKSÚRUN_COVERAGEÚRUNNING_ON_CIr  rŸ   r‰   rù   rü   rý   rþ   r   ÚtimingÚAbstractGenericWaitTestCaser  r  r  r  r  r  r  r  rR   Úmainr   r   r   r   Ú<module>   s^    vx

 %
	
ÿ