o
    ‡e¾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© úGD:\Projects\ConvertPro\env\Lib\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   Z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&   r/   )r   r   Úspawnr   Úgetr   )r   r-   r0   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   )r5   r   r   r   P   s   z;TestCoroutinePool.dont_test_timer_cancel.<locals>.some_workr   r   )r   r   r'   r(   r   r   r   )r5   r4   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ÚFakeFiler1   Úcrashr'   ÚTimeoutÚassertRaisesÚRuntimeErrorr2   r(   r   Ú
free_countÚ	start_newr   Újoin)r   rD   r   Z
normal_errÚwaiterr   r   r   Útest_stderr_raising`   s*   
ú
ÿüÿ
z%TestCoroutinePool.test_stderr_raisingN)Ú__name__Ú
__module__Ú__qualname__r'   r   ÚPoolr   r   r!   r$   Úerror_fatalr3   r8   r@   Ú	greentestZ
skipOnPyPyrO   r   r   r   r   r      s    

r   c                  O   ó   t dƒ‚)Nz*Raising an error from the crash() function©rJ   )Ú_argsZ_kwr   r   r   rG   …   ó   rG   c                   @   ó   e Zd Zdd„ ZdS )rF   c                 G   rV   )NzWriting to the file failedrW   )r   rX   r   r   r   Úwrite‹   rY   zFakeFile.writeN)rP   rQ   rR   r[   r   r   r   r   rF   ‰   ó    rF   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   rA   r"   r   )r   )é   )é   ç{®Gáz„?)r"   r   r^   r_   )
r   r   rK   r1   r)   r2   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"   rA   éè  r   )r   r1   r'   r(   ÚdiscardÚkillÚassertFalser   ÚlenZ
_semaphoreÚcounter)r   rb   rd   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"   rA   rf   r   rC   )r   r'   r1   r(   r   rK   rj   ÚaddrI   rH   rh   ©r   rb   rd   Ú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"   rA   rf   F)Úblocking©	r   r'   r1   r(   rm   rI   r   ÚPoolFullrh   rn   r   r   r   Útest_add_method_non_blockingÍ   ó   
ÿ€z+PoolBasicTests.test_add_method_non_blockingc                 C   rq   ©Nr"   rA   rf   rC   ©Útimeoutrs   rn   r   r   r   Útest_add_method_timeoutÜ   rv   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 rw   )r   r'   r1   r(   ZGreenletrm   rI   r   rt   Ústartrh   rn   r   r   r   Útest_start_method_timeoutë   rv   z(PoolBasicTests.test_start_method_timeoutc                 C   s(   |   ¡ }| dd„ d¡}|  |d¡ d S )Nc                 S   s   d| fS )NÚfoor   r9   r   r   r   r;   ü   r<   z+PoolBasicTests.test_apply.<locals>.<lambda>)r"   )r}   r"   r   )r   rb   r    r   r   r   r!   ú   s   zPoolBasicTests.test_applyc                 C   s   d| _ |  t| jd¡ d S )NFéÿÿÿÿ)Úswitch_expectedrI   Ú
ValueErrorr   ©r   r   r   r   Útest_init_errorÿ   s   zPoolBasicTests.test_init_errorN)rP   rQ   rR   r'   r   rS   r   re   rl   rp   rU   Úignores_leakcheckru   rz   r|   r!   r‚   r   r   r   r   r]      s    	


r]   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)rP   rQ   rR   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  rY   rŽ   c                 C   s   t  t ¡ d ¡ | |  S )NrC   )r'   r(   Úrandomr   r   r   r   Úsqr_random_sleep  ó   r   c                  c   s$    t dƒD ]} | V  qt d¡ d S )Nr^   çš™™™™™É?)Úranger'   r(   )Úir   r   r   Úfinal_sleep#  s   €r•   )gË¡E¶óý´?gìQ¸…ë¡?gìQ¸…ëÁ?é
   rf   é   é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   )rU   ÚTestCaseÚsetUpr'   r   rS   rB   r   r   r   r   r›   9  s   zTestPool.setUpc                 C   s   | j  ¡  d S r   )r   rM   r   r   r   r   Úcleanup=  r6   zTestPool.cleanupc                 C   s6   | j j}|  |tdƒd¡ |  |tdddiƒd¡ d S )Nr=   r—   r   r   r^   é	   )r   r   r   r   )r   Z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   Z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„   r2   r   ÚassertTimeoutAlmostEqualr†   ©r   Úresr2   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„   r2   r   r¥   r†   r'   r(   )r   r    r§   r2   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’   rx   r"   )r   r   r   ÚTIMEOUT2r„   r2   rI   r'   rH   r¥   r†   rM   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   ÚnextrI   Ú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³   rI   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   ra   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   ra   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 )NrC   r–   r   rŒ   ç      à?)
r   Z	map_asyncr'   r(   rB   r„   rh   ZassertTimeWithinRanger†   rM   )r   r    rh   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(   rB   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é{   rC   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Ò  rC   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"   r_   )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”   Z_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   r`   )Ú	enumerateÚ
assertTruer)   r'   r(   rj   Ú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   ra   )r   ÚiterablerÞ   rå   Úmethrâ   rã   Úlr   rä   r   Ú!test_imap_unordered_bounded_queue¸  s   ÿùz*TestPool.test_imap_unordered_bounded_queueN)rP   rQ   rR   rU   ZLARGE_TIMEOUTZ__timeout__rB   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©rP   rQ   rR   rB   r   r   r   r   rì   Ù  ó    rì   c                   @   rë   )Ú	TestPool3r^   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   rA   r`   rx   )r'   r   rS   r   rK   rà   ÚfullZwait_available©r   rb   r   r   r   Útest_wait_fullí  s   zTestPool0.test_wait_fullN)rP   rQ   rR   rB   rö   r   r   r   r   ró   ê  ó    ró   c                   @   rZ   )ÚTestJoinSleepc                 C   s>   t j ¡ }| t jd¡}z|j|d W | ¡  d S | ¡  w )Nr–   rx   ©r'   r   rS   r1   r(   rM   rh   ©r   ry   rb   Úgr   r   r   r   ö  s
   
zTestJoinSleep.waitN©rP   rQ   rR   r   r   r   r   r   rø   ô  r\   rø   c                   @   rZ   )ÚTestJoinSleep_raise_errorc                 C   s@   t j ¡ }| t jd¡}z|j|dd W | ¡  d S | ¡  w )Nr–   T)ry   Z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   rS   rM   rà   ©r   rb   r§   r   r   r   Útest  s   
zTestJoinEmpty.testN)rP   rQ   rR   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   rC   gR¸…ëQÈ?rÃ   )	r'   r   rS   r   rj   r1   r(   rU   Ú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   rC   r`   z*waiting on a full pool should return falsez waiting to finish should be true)
r'   r   rS   r   rj   r1   r(   rM   ri   rà   rÿ   r   r   r   ÚtestSpawnAndWait   s   
zTestSpawn.testSpawnAndWaitN)rP   rQ   rR   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 )Nr^   c                 S   ó   d S r   r   r   r   r   r   r;   6  rÏ   z*TestErrorInIterator.test.<locals>.<lambda>r%   )r'   r   rS   rI   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 )Nr^   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   ©rb   r   r   Ú	unordered<  s   z5TestErrorInIterator.test_unordered.<locals>.unorderedr%   )r'   r   rS   rI   r   r(   )r   r	  r   r  r   Útest_unordered9  s   z"TestErrorInIterator.test_unorderedN)rP   rQ   rR   rT   r   r
  r   r   r   r   r  1  s    r  c                 C   s   d|  S )Nç      ð?r   r   r   r   r   Ú	divide_byC  rY   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 )Nr^   ©r"   r   r   )r'   r   rS   rI   Ú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   rS   r­   r  r   r³   rI   r  r´   ©r   rb   r¯   r   r   r   Ú	test_imapN  ó   zTestErrorInHandler.test_imapc                 C   r  r  )
r'   r   rS   r»   r  r   r³   rI   r  r´   r  r   r   r   r¼   V  r  z&TestErrorInHandler.test_imap_unorderedN)rP   rQ   rR   rT   r¡   r  r¼   r   r   r   r   r  G  s
    r  Ú__main__)rŒ   )7r   r'   Zgevent.poolZgevent.eventr   Zgevent.queuer   Zgevent.testingÚtestingrU   Zgevent.testing.timingr   r   Zunittestrš   r   rG   ÚobjectrF   r]   r„   r   rŽ   r   r•   r¤   r«   ZTIMEOUT3rŸ   r¸   ZPYPYZWINZRUN_LEAKCHECKSZRUN_COVERAGEZRUNNING_ON_CIr  r™   rƒ   rì   rï   rð   rñ   ró   ZtimingZAbstractGenericWaitTestCaserø   rý   rþ   r  r  r  r  r  rP   Úmainr   r   r   r   Ú<module>   s^    vx

 %
	
ÿ