o
    diY                     @   sV   d dl Z d dlZd dlmZ d dlZddlmZ g dZe	ddZ
G dd deZdS )	    N)TestCase   )
async_test)ABC   c                   @   s0  e Zd Zedd Zedd Zedd Zedd Zed	d
 Zedd Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd  Zed!d" Zed#d$ Zed%d& Zed'd( Zed)d* Zed+d, Zed-d. Zed/d0 Zed1d2 Zed3d4 Zed5d6 Zed7d8 Zed9d: Z ed;d< Z!ed=d> Z"ed?d@ Z#edAdB Z$edCdD Z%edEdF Z&edGdH Z'edIdJ Z(edKdL Z)edMdN Z*edOdP Z+edQdR Z,edSdT Z-edUdV Z.edWdX Z/edYdZ Z0ed[d\ Z1ed]d^ Z2ed_d` Z3edadb Z4edcdd Z5ededf Z6edgdh Z7edidj Z8edkdl Z9edmdn Z:edodp Z;edqdr Z<edsdt Z=edudv Z>edwdx Z?edydz Z@ed{d| ZAed}d~ ZBedd ZCedd ZDedd ZEedd ZFdS )ItertoolsTestc                    sn   t t}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s0w   Y  d S )N)r         ait
accumulatesrangeassertEqualnextassertRaisesStopAsyncIterationselfitk r   P/home/ubuntu/.local/lib/python3.10/site-packages/aioitertools/tests/itertools.pytest_accumulate_range_default   s   
"z+ItertoolsTest.test_accumulate_range_defaultc                    st   t jttjd}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s3w   Y  d S )Nfuncr      r   )	r   r   r   operatormulr   r   r   r   r   r   r   r   test_accumulate_range_function      "z,ItertoolsTest.test_accumulate_range_functionc                    sz   dd }t jt|d}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s6w   Y  d S )Nc                    
   | | S Nr   abr   r   r   r    "      z:ItertoolsTest.test_accumulate_range_coroutine.<locals>.mulr   r   r   )r   r    r   r   r   r   r   test_accumulate_range_coroutine    s   "z-ItertoolsTest.test_accumulate_range_coroutinec                    s~   dd }t j| tjd}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s8w   Y  d S )Nc                   S     dV  dV  dV  d S Nr   r   r   r   r   r   r   r   gen-      
z7ItertoolsTest.test_accumulate_gen_function.<locals>.genr   r   r      )r   r   r   r    r   r   r   r   r   r,   r   r   r   r   r   test_accumulate_gen_function+   s   "z*ItertoolsTest.test_accumulate_gen_functionc                    s   dd }dd }t j| |d}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s;w   Y  d S )Nc                    r#   r$   r   r%   r   r   r   r    :   r(   z8ItertoolsTest.test_accumulate_gen_coroutine.<locals>.mulc                   S  r*   r+   r   r   r   r   r   r,   =   r-   z8ItertoolsTest.test_accumulate_gen_coroutine.<locals>.genr   r.   )r   r   r   r   r   r   )r   r    r,   r   r   r   r   r   test_accumulate_gen_coroutine8   s   "z+ItertoolsTest.test_accumulate_gen_coroutinec                    s:   g }t g 2 z3 d H W }|| q6 | |g  d S r$   )r   r   appendr   r   valuesvaluer   r   r   test_accumulate_emptyH   s   z#ItertoolsTest.test_accumulate_emptyc                    s   g dg fg ddg dfg ddddgfdd	gd
dgft g ddg dfg}|D ]\}}}dd t ||2 I d H }| || q+d S )Nr   r   r   r
   ))r   r   )r
   )r   r
   r   r   r   r
   )r      r   r
   )r;   r   )r   r   r   ))r<   r=   )r   r   r9   c                       g | z3 d H W }|q6 S r$   r   .0batchr   r   r   
<listcomp>Z       z.ItertoolsTest.test_batched.<locals>.<listcomp>)r   iterbatchedr   )r   test_matrixiterable
batch_sizeanswerresultr   r   r   test_batchedP   s   zItertoolsTest.test_batchedc                    s   |  td dd tdgd2 I d H  W d    n1 s!w   Y  |  td dd tjg dd	d
d2 I d H  W d    d S 1 sJw   Y  d S )Nzn must be at least onec                    r>   r$   r   r?   r   r   r   rB   a   rC   z5ItertoolsTest.test_batched_errors.<locals>.<listcomp>r   r   zincomplete batchc                    r>   r$   r   r?   r   r   r   rB   c   rC   r8   r   T)strict)assertRaisesRegex
ValueErrorr   rE   )r   r   r   r   test_batched_errors^   s    &"z!ItertoolsTest.test_batched_errorsc                    sp   t tt}dD ]}| t |I d H | q	| t t |I d H  W d    d S 1 s1w   Y  d S )N)r   r   r   r   r   r
   )r   chainslistr   r   r   r   r   r   r   r   r   test_chain_listse      "zItertoolsTest.test_chain_listsc                    sz   dd }t t| }dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s6w   Y  d S )Nc                  S     t dddD ]} | V  qd S Nr   	   ranger   r   r   r   r,   o      z/ItertoolsTest.test_chain_list_gens.<locals>.genr   r   r   r   r   r   r/   )r   rP   rQ   r   r   r   r   r0   r   r   r   test_chain_list_gensm   s   "z"ItertoolsTest.test_chain_list_gensc                    s~   dd }t jt| g}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s8w   Y  d S )Nc                  S  rT   rU   rW   rY   r   r   r   r,   {   rZ   z3ItertoolsTest.test_chain_from_iterable.<locals>.genr[   )r   rP   from_iterablerQ   r   r   r   r   r0   r   r   r   test_chain_from_iterabley   s   "z&ItertoolsTest.test_chain_from_iterablec                    s   dd   fdd}t j| }dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s<w   Y  d S )Nc                  S  rT   rU   rW   rY   r   r   r   r,      rZ   zKItertoolsTest.test_chain_from_iterable_parameter_expansion_gen.<locals>.genc                     s   t V    V  d S r$   rQ   r   r,   r   r   parameters_gen   s   zVItertoolsTest.test_chain_from_iterable_parameter_expansion_gen.<locals>.parameters_genr[   )r   rP   r]   r   r   r   r   )r   ra   r   r   r   r`   r   0test_chain_from_iterable_parameter_expansion_gen   s   "z>ItertoolsTest.test_chain_from_iterable_parameter_expansion_genc                    st   t tdd}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s3w   Y  d S )Nr   r
   ))r   r   r   )r   r   r
   )r   r   r
   r8   )r   combinationsrX   r   r   r   r   r   r   r   r   test_combinations   r"   zItertoolsTest.test_combinationsc                    p   t td}dD ]}| t |I d H | q	| t t |I d H  W d    d S 1 s1w   Y  d S )Nr   ))r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   combinations_with_replacementrQ   r   r   r   r   r   r   r   r   "test_combinations_with_replacement   s   "z0ItertoolsTest.test_combinations_with_replacementc                    s   t d}g d}t||}dD ]}| t|I d H | q| t t|I d H  W d    d S 1 s9w   Y  d S )N
   )
r   r   r   r   r   r   r   r   r   r   )r   r   r   r/   )rX   r   compressr   r   r   r   r   data	selectorsr   r   r   r   r   test_compress_list   s   "z ItertoolsTest.test_compress_listc                    s   d}t g d}t ||}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s:w   Y  d S )Nabcdefghijkl)r   r   r   )r&   dgj)r   cycleri   r   r   r   r   rj   r   r   r   test_compress_gen   s   "zItertoolsTest.test_compress_genc                    s0   t  }dD ]}| t |I d H | qd S )N)r   r   r   r
   r   countr   r   r   r   r   r   test_count_bare   s
   zItertoolsTest.test_count_barec                    s2   t d}dD ]}| t |I d H | qd S )N*   )rw   +   ,   -   rt   r   r   r   r   test_count_start   
   
zItertoolsTest.test_count_startc                    s4   t dd}dD ]}| t |I d H | q	d S )Nrw   r
   )rw   rz   0   3   rt   r   r   r   r   test_count_start_step   
   z#ItertoolsTest.test_count_start_stepc                    s4   t jdd}dD ]}| t |I d H | q	d S )Nr<   )step)r   r<   irt   r   r   r   r   test_count_negative   r   z!ItertoolsTest.test_count_negativec                    s2   t t}dD ]}| t |I d H | qd S )N)r   r   r   r   r   r   r   r   )r   rr   rQ   r   r   r   r   r   r   test_cycle_list   r|   zItertoolsTest.test_cycle_listc                    s<   dd }t | }dD ]}| t |I d H | qd S )Nc                   S  r*   Nr   r   rw   r   r   r   r   r   r,      r-   z)ItertoolsTest.test_cycle_gen.<locals>.gen)r   r   rw   r   r   rw   r   r   )r   rr   r   r   r0   r   r   r   test_cycle_gen   s   zItertoolsTest.test_cycle_genc                    2   dd }t t |g I d H }| |g  d S )Nc                 S      | dk S Nr   r   xr   r   r   pred      z0ItertoolsTest.test_dropwhile_empty.<locals>.pred)r   list	dropwhiler   )r   r   rJ   r   r   r   test_dropwhile_empty      z"ItertoolsTest.test_dropwhile_emptyc                    x   dd }t |t}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s5w   Y  d S )Nc                 S   r   r   r   r   r   r   r   r      r   z8ItertoolsTest.test_dropwhile_function_list.<locals>.predr:   r   r   r   r   r   r   r   r   r   r   r   r   r   r   test_dropwhile_function_list      "z*ItertoolsTest.test_dropwhile_function_listc                       dd }dd }t || }dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s:w   Y  d S )Nc                 S   r   r   r   r   r   r   r   r      r   z7ItertoolsTest.test_dropwhile_function_gen.<locals>.predc                   S  r*   r   r   r   r   r   r   r,     r-   z6ItertoolsTest.test_dropwhile_function_gen.<locals>.genr   rw   r   r   r   r   r   r   r   r   r,   r   r   r   r   r   test_dropwhile_function_gen      "z)ItertoolsTest.test_dropwhile_function_genc                    r   )Nc                    
   | dk S r   r   r   r   r   r   r     r(   z9ItertoolsTest.test_dropwhile_coroutine_list.<locals>.predr:   r   r   r   r   r   test_dropwhile_coroutine_list  r   z+ItertoolsTest.test_dropwhile_coroutine_listc                    r   )Nc                    r   r   r   r   r   r   r   r     r(   z8ItertoolsTest.test_dropwhile_coroutine_gen.<locals>.predc                   S  r*   r   r   r   r   r   r   r,     r-   z7ItertoolsTest.test_dropwhile_coroutine_gen.<locals>.genr   r   r   r   r   r   test_dropwhile_coroutine_gen  r   z*ItertoolsTest.test_dropwhile_coroutine_genc                    r   )Nc                 S   s   | d dkS Nr   r   r   r   r   r   r   r   +  s   z:ItertoolsTest.test_filterfalse_function_list.<locals>.predr   r
   r   filterfalser   r   r   r   r   r   r   r   r   test_filterfalse_function_list)  r   z,ItertoolsTest.test_filterfalse_function_listc                    r   )Nc                    s   | d dkS r   r   r   r   r   r   r   6  s   z;ItertoolsTest.test_filterfalse_coroutine_list.<locals>.predr   r   r   r   r   r   test_filterfalse_coroutine_list4  r   z-ItertoolsTest.test_filterfalse_coroutine_listc                    s   d}t |}dg dfdddgfddgffD ]}| t |I d H | q| t t |I d H  W d    d S 1 s@w   Y  d S )Naaabbar&   r&   r&   r&   r'   r   groupbyr   r   r   r   r   rk   r   r   r   r   r   test_groupby_list?  s   
$"zItertoolsTest.test_groupby_listc                    s   d}t j|tjd}dg dfdddgfddgffD ]}| t |I d H | q| t t |I d H  W d    d S 1 sCw   Y  d S )NaAabBAkeyr&   r&   r   r&   r'   r   r   r   r   strlowerr   r   r   r   r   r   r   r   test_groupby_list_keyI  s   $"z#ItertoolsTest.test_groupby_list_keyc                    s   dd }t | }dg dfdddgfddgffD ]}| t |I d H | q| t t |I d H  W d    d S 1 sCw   Y  d S )Nc                  S     dD ]} | V  qd S )Nr   r   cr   r   r   r,   U     z+ItertoolsTest.test_groupby_gen.<locals>.genr&   r   r'   r   r0   r   r   r   test_groupby_genS  s   $"zItertoolsTest.test_groupby_genc                    s   dd }t j| tjd}dg dfdddgfddgffD ]}| t |I d H | q| t t |I d H  W d    d S 1 sFw   Y  d S )	Nc                  S  r   )Nr   r   r   r   r   r   r,   a  r   z/ItertoolsTest.test_groupby_gen_key.<locals>.genr   r&   r   r'   r   r   r   r0   r   r   r   test_groupby_gen_key_  s   $"z"ItertoolsTest.test_groupby_gen_keyc                    s4   dd }t | 2 z3 d H W }| d q6 d S )Nc                  S  s   t dD ]} d V  qd S Nr   rW   )_r   r   r   r,   m  s   z-ItertoolsTest.test_groupby_empty.<locals>.genz!No iteration should have happened)r   r   fail)r   r,   r   r   r   r   test_groupby_emptyk  s
   z ItertoolsTest.test_groupby_emptyc                    s   |  td tddg2 z3 d H W }q6 W d    n1 s!w   Y  |  td tddgdddd2 z3 d H W }q86 W d    d S 1 sKw   Y  d S )Nzmust pass stop indexr   r   ztoo many argumentsr
   r   )rM   rN   r   islice)r   r   r   r   r   test_islice_bad_ranget  s   ""z#ItertoolsTest.test_islice_bad_rangec                    s@   g }t tdd2 z3 d H W }|| q6 | |g  d S )Nr;   r   )r   r   rX   r3   r   r4   r   r   r   test_islice_stop_zero~  s   z#ItertoolsTest.test_islice_stop_zeroc                    re   )Nr   r   r   r   r   r   r   r   r   r   r   r   r   r   test_islice_range_stop  rS   z$ItertoolsTest.test_islice_range_stopc                    st   t tdd d}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s3w   Y  d S )Nr   r   r   r   r   r   r   r   test_islice_range_start_step  r"   z*ItertoolsTest.test_islice_range_start_stepc                    sr   t tdd}dD ]}| t |I d H | q
| t t |I d H  W d    d S 1 s2w   Y  d S )Nr   r
   r:   r   r   r   r   r   test_islice_range_start_stop     "z*ItertoolsTest.test_islice_range_start_stopc                    st   t tddd}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s3w   Y  d S )Nr   r
   r   r9   r   r   r   r   r   !test_islice_range_start_stop_step  r"   z/ItertoolsTest.test_islice_range_start_stop_stepc                    s   dd }| }t |d}dD ]}| t |I d H | q| t t |I d H  W d    n1 s7w   Y  t |I d H ddgksJJ d S )Nc                   S     dV  dV  dV  dV  d S Nr   r   r
   r   r   r   r   r   r   r,     
   
z/ItertoolsTest.test_islice_gen_stop.<locals>.genr   r   r
   r   r   r   r   r   r   r   r   r   r,   gen_itr   r   r   r   r   test_islice_gen_stop  s    z"ItertoolsTest.test_islice_gen_stopc                    s~   dd }t | dd d}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s8w   Y  d S )Nc                   S  r   r   r   r   r   r   r   r,     r   z5ItertoolsTest.test_islice_gen_start_step.<locals>.genr   r   )r   r   r   r   r   r   r   r   r0   r   r   r   test_islice_gen_start_step  s   "z(ItertoolsTest.test_islice_gen_start_stepc                    s|   dd }t | dd}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s7w   Y  d S )Nc                   S  r   r   r   r   r   r   r   r,     r   z5ItertoolsTest.test_islice_gen_start_stop.<locals>.genr   r
   r:   r   r0   r   r   r   test_islice_gen_start_stop  s   "z(ItertoolsTest.test_islice_gen_start_stopc                    s   dd }| }t |ddd}dD ]}| t |I d H | q| t t |I d H  W d    n1 s9w   Y  t |I d H dgksKJ d S )Nc                   S  r   r   r   r   r   r   r   r,     r   z:ItertoolsTest.test_islice_gen_start_stop_step.<locals>.genr   r
   r   r9   r   r   r   r   r   r   test_islice_gen_start_stop_step  s   z-ItertoolsTest.test_islice_gen_start_stop_stepc                    sr   t jtdd}dD ]}| t |I d H | q
| t t |I d H  W d    d S 1 s2w   Y  d S )Nr   rr   r   )r   r   r:   )r
   r   )r
   r   )r   permutationsr   r   r   r   r   r   r   r   r   test_permutations_list  r   z$ItertoolsTest.test_permutations_listc                    s|   dd }t j| dd}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s7w   Y  d S )Nc                   S  r*   Nr   r   r
   r   r   r   r   r   r,     r-   z0ItertoolsTest.test_permutations_gen.<locals>.genr   r   r   )r   r   r   r   r   r   r0   r   r   r   test_permutations_gen  s   "z#ItertoolsTest.test_permutations_genc                    sx   t ddgddg}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s5w   Y  d S )Nr   r   r      )r   r   )r   r   )r   r   )r   r   r   productr   r   r   r   r   r   r   r   test_product_list  s   "zItertoolsTest.test_product_listc                    s   dd }t |d|d}dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s9w   Y  d S )Nc                 S  s   | V  | d V  d S )Nr   r   r   r   r   r   r,      s   z+ItertoolsTest.test_product_gen.<locals>.genr   r   r   r   r0   r   r   r   test_product_gen  s   "zItertoolsTest.test_product_genc                    s8   t d}dgd D ]}| t |I d H | qd S )Nrw   rh   )r   repeatr   r   r   r   r   r   test_repeat
  s
   
zItertoolsTest.test_repeatc                    sv   t dd}dgd D ]}| t |I d H | q| t t |I d H  W d    d S 1 s4w   Y  d S )Nrw   r;   )r   r   r   r   r   r   r   r   r   r   test_repeat_limit  s   "zItertoolsTest.test_repeat_limitc                       t d d t dd  t g}dd }t||}dD ]}| t|I d H | q| t t|I d H  W d    d S 1 sBw   Y  d S )Nr   r   c                  W   
   d | S N joinargsr   r   r   concat     
z8ItertoolsTest.test_starmap_function_list.<locals>.concatABBCABCrQ   r   starmapr   r   r   r   r   rk   r   r   r   r   r   r   test_starmap_function_list     "z(ItertoolsTest.test_starmap_function_listc                       dd }dd }t || }dD ]}| t |I d H | q| t t |I d H  W d    d S 1 s:w   Y  d S )Nc                   s   s(    t d d V  t dd  V  t V  d S Nr   r   r_   r   r   r   r   r,   '     
z4ItertoolsTest.test_starmap_function_gen.<locals>.genc                  W   r   r   r   r   r   r   r   r   ,  r   z7ItertoolsTest.test_starmap_function_gen.<locals>.concatr   r   r   r   r   r   r   r   r,   r   r   r   r   r   r   test_starmap_function_gen%     "z'ItertoolsTest.test_starmap_function_genc                    r   )Nr   r   c                        d | S r   r   r   r   r   r   r   9     
z9ItertoolsTest.test_starmap_coroutine_list.<locals>.concatr   r   r   r   r   r   test_starmap_coroutine_list5  r   z)ItertoolsTest.test_starmap_coroutine_listc                    r   )Nc                   S  s(   t d d V  t dd  V  t V  d S r   r_   r   r   r   r   r,   D  r   z5ItertoolsTest.test_starmap_coroutine_gen.<locals>.genc                     r   r   r   r   r   r   r   r   I  r   z8ItertoolsTest.test_starmap_coroutine_gen.<locals>.concatr   r   r   r   r   r   test_starmap_coroutine_genB  r   z(ItertoolsTest.test_starmap_coroutine_genc                    r   )Nc                 S   r   Nr
   r   r   r   r   r   r   T  r   z0ItertoolsTest.test_takewhile_empty.<locals>.pred)r   r   	takewhiler   )r   r   r5   r   r   r   test_takewhile_emptyR  r   z"ItertoolsTest.test_takewhile_emptyc                    r   )Nc                 S   r   r  r   r   r   r   r   r   \  r   z8ItertoolsTest.test_takewhile_function_list.<locals>.predr   r   r  r   r   r   r   r   r   r   r   r   test_takewhile_function_listZ  r   z*ItertoolsTest.test_takewhile_function_listc                    r   )Nc                   S  r*   r   r   r   r   r   r   r,   g  r-   z6ItertoolsTest.test_takewhile_function_gen.<locals>.genc                 S   r   r  r   r   r   r   r   r   l  r   z7ItertoolsTest.test_takewhile_function_gen.<locals>.predr   r   r  r   r   r   r   r   r,   r   r   r   r   r   r   test_takewhile_function_gene  r   z)ItertoolsTest.test_takewhile_function_genc                    r   )Nc                    r   r  r   r   r   r   r   r   w  r(   z9ItertoolsTest.test_takewhile_coroutine_list.<locals>.predr   r  r   r   r   r   test_takewhile_coroutine_listu  r   z+ItertoolsTest.test_takewhile_coroutine_listc                    r   )Nc                   s   s    dV  dV  dV  d S r   r   r   r   r   r   r,     r-   z7ItertoolsTest.test_takewhile_coroutine_gen.<locals>.genc                    r   r  r   r   r   r   r   r     r(   z8ItertoolsTest.test_takewhile_coroutine_gen.<locals>.predr   r  r  r   r   r   test_takewhile_coroutine_gen  r   z*ItertoolsTest.test_takewhile_coroutine_genc              	      s   t td \}}td D ]%}tt |t |I d H \}}| || | || | || q||fD ]}| t t |I d H  W d    n1 sRw   Y  q8d S r   )	r   teerQ   asynciogatherr   r   r   r   )r   it1it2r   r&   r'   r   r   r   r   test_tee_list_two  s   "zItertoolsTest.test_tee_list_twoc              	      s   t jtd dd}td D ]}tjdd |D  I d H }|D ]}| || qq|D ]}| t t |I d H  W d    n1 sEw   Y  q+d S )Nr   r   nc                 S      g | ]}t |qS r   r   r   r@   r   r   r   r   rB         z3ItertoolsTest.test_tee_list_six.<locals>.<listcomp>)	r   r  rQ   r  r  r   r   r   r   )r   itrsr   r5   r6   r   r   r   r   test_tee_list_six  s   zItertoolsTest.test_tee_list_sixc              	      s   dd }t | \}}dD ]%}tt |t |I d H \}}| || | || | || q||fD ]}| t t |I d H  W d    n1 sSw   Y  q9d S )Nc                   S  r   Nr   r   rV      r   r   r   r   r   r,     r   z+ItertoolsTest.test_tee_gen_two.<locals>.genr   r   rV   r  )r   r  r  r  r   r   r   r   )r   r,   r  r  r   r&   r'   r   r   r   r   test_tee_gen_two  s   "zItertoolsTest.test_tee_gen_twoc              	      s   dd }t j| dd}dD ]}tjdd |D  I d H }|D ]}| || q q|D ]}| t t |I d H  W d    n1 sFw   Y  q,d S )Nc                   S  r   r  r   r   r   r   r   r,     r   z+ItertoolsTest.test_tee_gen_six.<locals>.genr   r  r  c                 S   r  r   r  r  r   r   r   rB     r  z2ItertoolsTest.test_tee_gen_six.<locals>.<listcomp>)r   r  r  r  r   r   r   r   )r   r,   r  r   r5   r6   r   r   r   r   test_tee_gen_six  s   zItertoolsTest.test_tee_gen_sixc                    sn   G dd dt   fdd}dd }t| \}}tj||||ddI d H }|D ]}| |  q,d S )	Nc                   @   s   e Zd ZdS )z;ItertoolsTest.test_tee_propagate_exception.<locals>.MyErrorN)__name__
__module____qualname__r   r   r   r   MyError  s    r!  c                     s   dV  dV   )Nr   r   r   r   r!  r   r   r,     s   z7ItertoolsTest.test_tee_propagate_exception.<locals>.genc                    s&   d}| 2 z
3 d H W }||7 }q6 |S r   r   )r   rJ   itemr   r   r   consumer  s   
z<ItertoolsTest.test_tee_propagate_exception.<locals>.consumerT)return_exceptions)	Exceptionr   r  r  r  assertIsInstance)r   r,   r$  r  r  r5   r6   r   r"  r   test_tee_propagate_exception  s   z*ItertoolsTest.test_tee_propagate_exceptionc                    s   t d}t d}t||}dD ]}| t|I d H | q| t t|I d H  W d    d S 1 s9w   Y  d S )Nr
   r;   ))r   r   )r   r   )r   r   r  )Nr   rX   r   zip_longestr   r   r   r   )r   r&   r'   r   r   r   r   r   test_zip_longest_range  s   "z$ItertoolsTest.test_zip_longest_rangec                    s   dd }| }t d}tj||dd}dD ]}| t|I d H | q| t t|I d H  W d    d S 1 s>w   Y  d S )Nc                   S  r   r  r   r   r   r   r   r,     r   z5ItertoolsTest.test_zip_longest_fillvalue.<locals>.genr;   rw   )	fillvalue))r   r   )r   r   )rV   r   )r  r
   )rw   r   r)  r   r,   r&   r'   r   r   r   r   r   test_zip_longest_fillvalue  s   "z(ItertoolsTest.test_zip_longest_fillvaluec                    s   dd }| }t d}t ||}dD ]}| t |I d H | q| td t |I d H  W d    d S 1 s>w   Y  d S )Nc                   S  s   dV  dV  t d)Nr   r   
fake error)r&  r   r   r   r   r,   	  s   z5ItertoolsTest.test_zip_longest_exception.<locals>.genr;   ))r   r;   )r   r;   r/  )r   r   r*  r   r   rM   r&  r-  r   r   r   test_zip_longest_exception  s   
"z(ItertoolsTest.test_zip_longest_exceptionN)Gr  r  r   r   r   r!   r)   r1   r2   r7   rK   rO   rR   r\   r^   rb   rd   rg   rm   rs   rv   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   r   r   r   r   r   r   r   r   r  r  r  r	  r
  r  r  r  r  r(  r+  r.  r0  r   r   r   r   r	      s   





































	
	



	
































r	   )r  r   unittestr   aioitertoolsr   helpersr   rQ   rX   r   r	   r   r   r   r   <module>   s   
