
    DhY                     d    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e      Zy)	    N)TestCase   )
async_test)ABC   c                   <   e Zd Zed        Zed        Zed        Zed        Zed        Zed        Z	ed        Z
ed        Zed	        Zed
        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Zed        Z ed        Z!ed        Z"ed         Z#ed!        Z$ed"        Z%ed#        Z&ed$        Z'ed%        Z(ed&        Z)ed'        Z*ed(        Z+ed)        Z,ed*        Z-ed+        Z.ed,        Z/ed-        Z0ed.        Z1ed/        Z2ed0        Z3ed1        Z4ed2        Z5ed3        Z6ed4        Z7ed5        Z8ed6        Z9ed7        Z:ed8        Z;ed9        Z<ed:        Z=ed;        Z>ed<        Z?ed=        Z@ed>        ZAed?        ZBed@        ZCedA        ZDedB        ZEedC        ZFyD)EItertoolsTestc                 <  K   t        j                  t              }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)N)r         ait
accumulatesrangeassertEqualnextassertRaisesStopAsyncIterationselfitks      ~/var/www/fastuser/data/www/generator.snapmosaic.io/flask_app/venv/lib/python3.12/site-packages/aioitertools/tests/itertools.pytest_accumulate_range_defaultz+ItertoolsTest.test_accumulate_range_default   s     ^^F# 	4A388B</3	412 	((2,	 	 0	 	s<   ABB
 B%B>B?B
BBBBc                 \  K   t        j                  t        t        j                        }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nfuncr      r   )	r   r   r   operatormulr   r   r   r   r   s      r   test_accumulate_range_functionz,ItertoolsTest.test_accumulate_range_function   s     ^^F6 	4A388B</3	412 	((2,	 	 0	 	s<   AB,B
 B,5B BB 
B,B  B)%B,c                 F  K   d }t        j                  t        |      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                    K   | |z  S wN abs     r   r#   z:ItertoolsTest.test_accumulate_range_coroutine.<locals>.mul"        q5L   r   r    r   )r   r#   r   r   s       r   test_accumulate_range_coroutinez-ItertoolsTest.test_accumulate_range_coroutine    s     	 ^^F- 	4A388B</3	412 	((2,	 	 0	 	<   AB!	B

 B!*BBB
B!BBB!c                 d  K   d }t        j                   |       t        j                        }dD ]/  }| j	                  t        j
                  |       d {   |       1 | j                  t              5  t        j
                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 *   K   d d d y wNr   r!   r	   r(   r(       r   genz7ItertoolsTest.test_accumulate_gen_function.<locals>.gen-        GGG   r   r   r!      )r   r   r"   r#   r   r   r   r   r   r4   r   r   s       r   test_accumulate_gen_functionz*ItertoolsTest.test_accumulate_gen_function+   s     	
 ^^CE5 	4A388B</3	412 	((2,	 	 0	 	<   AB0B 
 B09B$B"B$
B0"B$$B-)B0c                 N  K   d }d }t        j                   |       |      }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                    K   | |z  S wr'   r(   r)   s     r   r#   z8ItertoolsTest.test_accumulate_gen_coroutine.<locals>.mul:   r,   r-   c                 *   K   d d d y wr2   r(   r(   r3   r   r4   z8ItertoolsTest.test_accumulate_gen_coroutine.<locals>.gen=   r5   r6   r   r7   )r   r   r   r   r   r   )r   r#   r4   r   r   s        r   test_accumulate_gen_coroutinez+ItertoolsTest.test_accumulate_gen_coroutine8   s     		
 ^^CE, 	4A388B</3	412 	((2,	 	 0	 	<   AB%B
 B%.BBB
B%BB"B%c                    K   g }t        j                  g       2 3 d {   }|j                  |       7 6 | j                  |g        y wr'   )r   r   appendr   r   valuesvalues      r   test_accumulate_emptyz#ItertoolsTest.test_accumulate_emptyH   sJ     >>"- 	! 	!%MM% 	!- 	$s   A757A7Ac                   K   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        j                  g d      dg dfg}|D ]+  \  }}}t        j                  ||      2 cg c3 d {   }| y 7 	6 nc c}w }}| j                  ||       Mw)Nr   r   r!   r   ))r   r!   )r   )r!   r   r	   r!   r!   r   )r	      r   r   )rK   r   )r   r   r!   ))rL   rM   )r   r   rI   )r   iterbatchedr   )r   test_matrixiterable
batch_sizeanswerbatchresults          r   test_batchedzItertoolsTest.test_batchedP   s      BK-.FD>*VQ!XX'(!-EF
 -8 	-(Hj&/2{{8Z/PQQee	-QQQFQVV,s<   AB
A0A."A,#A.&A0*B
,A..A0/B
c                   K   | j                  t        d      5  t        j                  dgd      2 cg c3 d {   }|7 6 nc c}w c} d d d        n# 1 sw Y   nxY w| j                  t        d      5  t        j                  g ddd      2 cg c3 d {  7  }|6 nc c}w c} d d d        y # 1 sw Y   y xY ww)	Nzn must be at least oner   r   zincomplete batchrH   r!   T)strict)assertRaisesRegex
ValueErrorr   rO   )r   rT   s     r   test_batched_errorsz!ItertoolsTest.test_batched_errors^   s     ##J0HI 	;&)kk1#q&9::UU:::	; 	; 	;##J0BC 	N&)kk)Qt&LMMUUMM	N 	N 	Ns   CAAAAAAAA	A	CAC8B7B&B$BB$ B&%	B7.	C7C <Cc                 F  K   t        j                  t        t              }dD ]/  }| j	                  t        j
                  |       d {   |       1 | j                  t              5  t        j
                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)N)r   r   r   r   r!   r   )r   chainslistr   r   r   r   r   r   s      r   test_chain_listszItertoolsTest.test_chain_listse   s     YYuf%) 	4A388B</3	412 	((2,	 	 0	 	r/   c                 N  K   d }t        j                  t         |             }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 :   K   t        ddd      D ]  } |  	 y wNr!   	   ranger   s    r   r4   z/ItertoolsTest.test_chain_list_gens.<locals>.geno   "     1a^    r   r   r   r!   r	   r   r8   )r   r]   r^   r   r   r   r   r9   s       r   test_chain_list_gensz"ItertoolsTest.test_chain_list_gensm   s     	 YYuce$, 	4A388B</3	412 	((2,	 	 0	 	r@   c                 d  K   d }t         j                  j                  t         |       g      }dD ]/  }| j	                  t        j
                  |       d {   |       1 | j                  t              5  t        j
                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 :   K   t        ddd      D ]  } |  	 y wrb   rd   rf   s    r   r4   z3ItertoolsTest.test_chain_from_iterable.<locals>.gen{   rg   rh   ri   )r   r]   from_iterabler^   r   r   r   r   r9   s       r   test_chain_from_iterablez&ItertoolsTest.test_chain_from_iterabley   s     	 YY$$eSU^4, 	4A388B</3	412 	((2,	 	 0	 	r;   c                 d  K   d fd}t         j                  j                   |             }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 :   K   t        ddd      D ]  } |  	 y wrb   rd   rf   s    r   r4   zKItertoolsTest.test_chain_from_iterable_parameter_expansion_gen.<locals>.gen   rg   rh   c                 4   K   t                    y wr'   r^   )r4   s   r   parameters_genzVItertoolsTest.test_chain_from_iterable_parameter_expansion_gen.<locals>.parameters_gen   s     K%Ks   ri   )r   r]   rm   r   r   r   r   )r   rs   r   r   r4   s       @r   0test_chain_from_iterable_parameter_expansion_genz>ItertoolsTest.test_chain_from_iterable_parameter_expansion_gen   s     		 YY$$^%56, 	4A388B</3	412 	((2,	 	 0	 	s<   AB0B 
 B09B$B"B$
B0"B$$B-)B0c                 H  K   t        j                  t        d      d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr	   r   ))r   r   r!   )r   r   r   )r   r!   r   rH   )r   combinationsre   r   r   r   r   r   s      r   test_combinationszItertoolsTest.test_combinations   s     eAh*= 	4A388B</3	412 	((2,	 	 0	 	<   AB"
B
 B"+BBB	
B"BBB"c                 >  K   t        j                  t        d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr!   ))r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   combinations_with_replacementr^   r   r   r   r   r   s      r   "test_combinations_with_replacementz0ItertoolsTest.test_combinations_with_replacement   s     ..ua8
 	4A 388B</3	4 12 	((2,	 	 0	 	<   ABB
 B&B?B B
BBBBc                 T  K   t        d      }g d}t        j                  ||      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)N
   )
r   r   r   r   r   r   r   r   r   r   )r   r!   r   r8   )re   r   compressr   r   r   r   r   data	selectorsr   r   s        r   test_compress_listz ItertoolsTest.test_compress_list   s     Ry2	\\$	* 	4A388B</3	412 	((2,	 	 0	 	<   AB(B
 B(1B
BB
B(BB%!B(c                 h  K   d}t        j                  g d      }t        j                  ||      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nabcdefghijkl)r   r   r   )r*   dgj)r   cycler   r   r   r   r   r   s        r   test_compress_genzItertoolsTest.test_compress_gen   s     IIi(	\\$	*% 	4A388B</3	412 	((2,	 	 0	 	s<   AB2B"
 B2;B&B$B&
B2$B&&B/+B2c                    K   t        j                         }dD ]/  }| j                  t        j                  |       d {   |       1 y 7 w)N)r   r   r!   r   r   countr   r   r   s      r   test_count_barezItertoolsTest.test_count_bare   s>     YY[ 	4A388B</3	4/s   =AA
 Ac                    K   t        j                  d      }dD ]/  }| j                  t        j                  |       d {   |       1 y 7 w)N*   )r   +   ,   -   r   r   s      r   test_count_startzItertoolsTest.test_count_start   s@     YYr]! 	4A388B</3	4/s   >A A
Ac                    K   t        j                  dd      }dD ]/  }| j                  t        j                  |       d {   |       1 y 7 w)Nr   r   )r   r   0   3   r   r   s      r   test_count_start_stepz#ItertoolsTest.test_count_start_step   sC     YYr1! 	4A388B</3	4/   ?AA
Ac                    K   t        j                  d      }dD ]/  }| j                  t        j                  |       d {   |       1 y 7 w)NrL   )step)r   rL   ir   r   s      r   test_count_negativez!ItertoolsTest.test_count_negative   sA     YYB  	4A388B</3	4/r   c                    K   t        j                  t              }dD ]/  }| j                  t        j                  |       d {   |       1 y 7 w)N)r   r   r   r   r   r   r   r   )r   r   r^   r   r   r   s      r   test_cycle_listzItertoolsTest.test_cycle_list   sA     YYu9 	4A388B</3	4/   AAA
Ac                    K   d }t        j                   |             }dD ]/  }| j                  t        j                  |       d {   |       1 y 7 w)Nc                 *   K   d d d y wNr   r!   r   r(   r(   r3   r   r4   z)ItertoolsTest.test_cycle_gen.<locals>.gen        GGHr6   )r   r!   r   r   r!   r   r   r!   )r   r   r   r   r9   s       r   test_cycle_genzItertoolsTest.test_cycle_gen   sJ     	
 YYsu+ 	4A388B</3	4/s   AAA
	Ac                    K   d }t        j                  t        j                  |g              d {   }| j                  |g        y 7 w)Nc                     | dk  S Nr!   r(   xs    r   predz0ItertoolsTest.test_dropwhile_empty.<locals>.pred       q5Lr3   )r   list	dropwhiler   )r   r   rU   s      r   test_dropwhile_emptyz"ItertoolsTest.test_dropwhile_empty   >     	 xxdB 788$ 9   0AA
Ac                 D  K   d }t        j                  |t              }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                     | dk  S r   r(   r   s    r   r   z8ItertoolsTest.test_dropwhile_function_list.<locals>.pred   r   r3   rJ   r   r   r   r   r   r   r   r   r   r   r   s       r   test_dropwhile_function_listz*ItertoolsTest.test_dropwhile_function_list        	 ]]4( 	4A388B</3	412 	((2,	 	 0	 	<   AB B
	 B )BBB
B BBB c                 L  K   d }d }t        j                  | |             }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                     | dk  S r   r(   r   s    r   r   z7ItertoolsTest.test_dropwhile_function_gen.<locals>.pred   r   r3   c                 *   K   d d d y wr   r(   r(   r3   r   r4   z6ItertoolsTest.test_dropwhile_function_gen.<locals>.gen  r   r6   r!   r   r   r   r   r   r   r   r   r   r4   r   r   s        r   test_dropwhile_function_genz)ItertoolsTest.test_dropwhile_function_gen        		
 ]]4' 	4A388B</3	412 	((2,	 	 0	 	<   A
B$B
 B$-BBB
B$BB!B$c                 D  K   d }t        j                  |t              }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                    K   | dk  S wr   r(   r   s    r   r   z9ItertoolsTest.test_dropwhile_coroutine_list.<locals>.pred  r,   r-   rJ   r   r   s       r   test_dropwhile_coroutine_listz+ItertoolsTest.test_dropwhile_coroutine_list  r   r   c                 L  K   d }d }t        j                  | |             }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                    K   | dk  S wr   r(   r   s    r   r   z8ItertoolsTest.test_dropwhile_coroutine_gen.<locals>.pred  r,   r-   c                 *   K   d d d y wr   r(   r(   r3   r   r4   z7ItertoolsTest.test_dropwhile_coroutine_gen.<locals>.gen  r   r6   r   r   r   s        r   test_dropwhile_coroutine_genz*ItertoolsTest.test_dropwhile_coroutine_gen  r   r   c                 D  K   d }t        j                  |t              }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                     | dz  dk(  S Nr!   r   r(   r   s    r   r   z:ItertoolsTest.test_filterfalse_function_list.<locals>.pred+  s    q5A:r3   r   r   r   filterfalser   r   r   r   r   r   s       r   test_filterfalse_function_listz,ItertoolsTest.test_filterfalse_function_list)       	 __T6* 	4A388B</3	412 	((2,	 	 0	 	r   c                 D  K   d }t        j                  |t              }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                    K   | dz  dk(  S wr   r(   r   s    r   r   z;ItertoolsTest.test_filterfalse_coroutine_list.<locals>.pred6  s     q5A:s   	r   r   r   s       r   test_filterfalse_coroutine_listz-ItertoolsTest.test_filterfalse_coroutine_list4  r   r   c                 T  K   d}t        j                  |      }dg dfdddgfddgffD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Naaabbar*   r*   r*   r*   r+   r   groupbyr   r   r   r   r   r   r   r   s       r   test_groupby_listzItertoolsTest.test_groupby_list?  s     [[(3c
*;cC5\J 	4A388B</3	412 	((2,	 	 0	 	r   c                 t  K   d}t        j                  |t        j                        }dg dfdddgfddgffD ]/  }| j	                  t        j
                  |       d {   |       1 | j                  t              5  t        j
                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)NaAabBAkeyr*   r*   r   r*   r+   r   r   r   r   strlowerr   r   r   r   r   s       r   test_groupby_list_keyz#ItertoolsTest.test_groupby_list_keyI  s     [[399-(3c
*;cC5\J 	4A388B</3	412 	((2,	 	 0	 	s<   AB8 B(
! B8B,B*B,
B8*B,,B51B8c                 `  K   d }t        j                   |             }dg dfdddgfddgffD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 $   K   dD ]  } |  	 y w)Nr   r(   cs    r   r4   z+ItertoolsTest.test_groupby_gen.<locals>.genU           r*   r   r+   r   r9   s       r   test_groupby_genzItertoolsTest.test_groupby_genS  s     	 [[(3c
*;cC5\J 	4A388B</3	412 	((2,	 	 0	 	s<   AB.B
 B.7B"B B"
B. B""B+'B.c                   K   d }t        j                   |       t        j                        }dg dfdddgfddgffD ]/  }| j	                  t        j
                  |       d {   |       1 | j                  t              5  t        j
                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 $   K   dD ]  } |  	 y w)Nr   r(   r   s    r   r4   z/ItertoolsTest.test_groupby_gen_key.<locals>.gena  r   r   r   r*   r   r+   r   r   r   r9   s       r   test_groupby_gen_keyz"ItertoolsTest.test_groupby_gen_key_  s     	 [[CII.(3c
*;cC5\J 	4A388B</3	412 	((2,	 	 0	 	s<   A$B>&B.
' B>B2 B0!B2%
B>0B22B;7B>c                    K   d }t        j                   |             2 3 d {   }| j                  d       7 6 y w)Nc                 6   K   t        d      D ]  } d  	 y wNr   rd   )_s    r   r4   z-ItertoolsTest.test_groupby_empty.<locals>.genm  s     1X s   z!No iteration should have happened)r   r   fail)r   r4   r   s      r   test_groupby_emptyz ItertoolsTest.test_groupby_emptyk  s=     	 {{35) 	; 	;!II9:	;)s   ?=;=?=?c                 T  K   | j                  t        d      5  t        j                  ddg      2 3 d {   }
7 6 	 d d d        n# 1 sw Y   nxY w| j                  t        d      5  t        j                  ddgdddd      2 3 d {  7  }6 	 d d d        y # 1 sw Y   y xY ww)Nzmust pass stop indexr   r!   ztoo many argumentsr   r	   )rY   rZ   r   islice)r   r   s     r   test_islice_bad_rangez#ItertoolsTest.test_islice_bad_ranget  s     ##J0FG 	::q!f-  a-	 	 	 ##J0DE 	::q!faAq9  a :	 	 	se   B(A=;=A=A	B(AB(*BB
BBB	B(B%!B(c                    K   g }t        j                  t        d      d      2 3 d {   }|j                  |       7 6 | j	                  |g        y w)NrK   r   )r   r   re   rB   r   rC   s      r   test_islice_stop_zeroz#ItertoolsTest.test_islice_stop_zero~  sN     ::eAh2 	! 	!%MM% 	!2$s#   "AA?AAAAc                 >  K   t        j                  t        d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr!   r   r!   r   r   r   r   r   r   r   r   s      r   test_islice_range_stopz$ItertoolsTest.test_islice_range_stop  s     ZZ" 	4A388B</3	412 	((2,	 	 0	 	r|   c                 B  K   t        j                  t        dd d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr   r!   r   r   r   s      r   test_islice_range_start_stepz*ItertoolsTest.test_islice_range_start_step  s     ZZ4+ 	4A388B</3	412 	((2,	 	 0	 	<   ABB
 B(BBB
BBBBc                 @  K   t        j                  t        dd      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr   r   rJ   r   r   s      r   test_islice_range_start_stopz*ItertoolsTest.test_islice_range_start_stop  s     ZZ1% 	4A388B</3	412 	((2,	 	 0	 	<   ABB
 B'B BB
BBBBc                 B  K   t        j                  t        ddd      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr   r   r!   rI   r   r   s      r   !test_islice_range_start_stop_stepz/ItertoolsTest.test_islice_range_start_stop_step  s     ZZ1a( 	4A388B</3	412 	((2,	 	 0	 	r   c                   K   d } |       }t        j                  |d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        t        j                  |       d {   ddgk(  sJ y 7 k7 3# 1 sw Y   2xY w7 w)Nc                 4   K   d d d d y wNr   r!   r   r	   r(   r(   r3   r   r4   z/ItertoolsTest.test_islice_gen_stop.<locals>.gen       GGGG   r!   r   r   r	   r   r   r   r   r   r   r   r   r4   gen_itr   r   s        r   test_islice_gen_stopz"ItertoolsTest.test_islice_gen_stop  s     	 ZZ" 	4A388B</3	412 	((2,	XXf%%!Q/// 0	 	%sH   A	C	B7
 C	,B;B9B;
 C	*C+C	9B;;C C	c                 J  K   d }t        j                   |       dd d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 4   K   d d d d y wr  r(   r(   r3   r   r4   z5ItertoolsTest.test_islice_gen_start_step.<locals>.gen  r	  r
  r   r!   )r!   r	   r   r   r   r   r   r   r9   s       r   test_islice_gen_start_stepz(ItertoolsTest.test_islice_gen_start_step  s     	 ZZq$* 	4A388B</3	412 	((2,	 	 0	 	s<   A	B#B
 B#,BBB

B#BB B#c                 H  K   d }t        j                   |       dd      }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 4   K   d d d d y wr  r(   r(   r3   r   r4   z5ItertoolsTest.test_islice_gen_start_stop.<locals>.gen  r	  r
  r   r   rJ   r  r9   s       r   test_islice_gen_start_stopz(ItertoolsTest.test_islice_gen_start_stop  s     	 ZZq!$ 	4A388B</3	412 	((2,	 	 0	 	rx   c                   K   d } |       }t        j                  |ddd      }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        t        j                  |       d {   dgk(  sJ y 7 j7 2# 1 sw Y   1xY w7 w)Nc                 4   K   d d d d y wr  r(   r(   r3   r   r4   z:ItertoolsTest.test_islice_gen_start_stop_step.<locals>.gen  r	  r
  r   r   r!   rI   r	   r  r  s        r   test_islice_gen_start_stop_stepz-ItertoolsTest.test_islice_gen_start_stop_step  s     	 ZZ1a( 	4A388B</3	412 	((2,	XXf%%!,,, 0	 	%sH   AC
B8
 C
.B<B:B< C
,C-C
:B<<CC
c                 @  K   t        j                  t        d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr!   rr   r   )r!   r   rJ   )r   r   )r   r!   )r   permutationsr   r   r   r   r   r   s      r   test_permutations_listz$ItertoolsTest.test_permutations_list  s     f*A 	4A388B</3	412 	((2,	 	 0	 	r  c                 H  K   d }t        j                   |       d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 *   K   d d d y wNr   r!   r   r(   r(   r3   r   r4   z0ItertoolsTest.test_permutations_gen.<locals>.gen  r5   r6   r!   r  r  )r   r  r   r   r   r   r9   s       r   test_permutations_genz#ItertoolsTest.test_permutations_gen  s     	
 ceq)A 	4A388B</3	412 	((2,	 	 0	 	rx   c                 >  K   t        j                  ddgddg      }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr   r!   r      )r   r   )r   r$  )r!   r   )r!   r$  r   productr   r   r   r   r   s      r   test_product_listzItertoolsTest.test_product_list  s     [[!Q!Q(1 	4A388B</3	412 	((2,	 	 0	 	r|   c                 T  K   d }t        j                   |d       |d            }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                &   K   |  | dz    y w)Nr   r(   r   s    r   r4   z+ItertoolsTest.test_product_gen.<locals>.gen   s     Ga%Ks   r   r   r%  r&  r9   s       r   test_product_genzItertoolsTest.test_product_gen  s     	 [[QQ(1 	4A388B</3	412 	((2,	 	 0	 	r   c                    K   t        j                  d      }dgdz  D ]/  }| j                  t        j                  |       d {   |       1 y 7 w)Nr   r~   )r   repeatr   r   r   s      r   test_repeatzItertoolsTest.test_repeat
  sF     ZZ^ 	4A388B</3	4/r   c                 >  K   t        j                  dd      }dgdz  D ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr   rK   )r   r-  r   r   r   r   r   s      r   test_repeat_limitzItertoolsTest.test_repeat_limit  s     ZZA 	4A388B</3	412 	((2,	 	 0	 	r|   c                 j  K   t         d d t         dd  t         g}d }t        j                  ||      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr!   r   c                  $    dj                  |       S N joinargss    r   concatz8ItertoolsTest.test_starmap_function_list.<locals>.concat      774= r3   ABBCABCr^   r   starmapr   r   r   r   r   r   r9  r   r   s        r   test_starmap_function_listz(ItertoolsTest.test_starmap_function_list       bq	59e,	! [[&$ 	4A388B</3	412 	((2,	 	 0	 	<   AB3B#
 B3<B'B%B'
B3%B''B0,B3c                 L  K   d }d }t        j                  | |             }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc               3   H   K   t         d d  t         dd   t          y wNr!   r   rr   r(   r3   r   r4   z4ItertoolsTest.test_starmap_function_gen.<locals>.gen'  s!     )O)OKs    "c                  $    dj                  |       S r3  r5  r7  s    r   r9  z7ItertoolsTest.test_starmap_function_gen.<locals>.concat,  r:  r3   r;  r   r@  r   r   r   r   r   r4   r9  r   r   s        r   test_starmap_function_genz'ItertoolsTest.test_starmap_function_gen%       	
	! [['$ 	4A388B</3	412 	((2,	 	 0	 	r   c                 j  K   t         d d t         dd  t         g}d }t        j                  ||      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr!   r   c                  ,   K   dj                  |       S wr3  r5  r7  s    r   r9  z9ItertoolsTest.test_starmap_coroutine_list.<locals>.concat9       774=    r;  r?  rA  s        r   test_starmap_coroutine_listz)ItertoolsTest.test_starmap_coroutine_list5  rC  rD  c                 L  K   d }d }t        j                  | |             }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 N   K   t         d d  t         dd   t          y wrG  rr   r(   r3   r   r4   z5ItertoolsTest.test_starmap_coroutine_gen.<locals>.genD  s!     )O)OKs   #%c                  ,   K   dj                  |       S wr3  r5  r7  s    r   r9  z8ItertoolsTest.test_starmap_coroutine_gen.<locals>.concatI  rO  rP  r;  rI  rJ  s        r   test_starmap_coroutine_genz(ItertoolsTest.test_starmap_coroutine_genB  rL  r   c                    K   d }t        j                  t        j                  |g              d {   }| j                  |g        y 7 w)Nc                     | dk  S Nr   r(   r   s    r   r   z0ItertoolsTest.test_takewhile_empty.<locals>.predT  r   r3   )r   r   	takewhiler   )r   r   rD   s      r   test_takewhile_emptyz"ItertoolsTest.test_takewhile_emptyR  r   r   c                 D  K   d }t        j                  |t              }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                     | dk  S rX  r(   r   s    r   r   z8ItertoolsTest.test_takewhile_function_list.<locals>.pred\  r   r3   r   r   rY  r   r   r   r   r   r   s       r   test_takewhile_function_listz*ItertoolsTest.test_takewhile_function_listZ  r   r   c                 L  K   d }d }t        j                  | |             }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 *   K   d d d y wr!  r(   r(   r3   r   r4   z6ItertoolsTest.test_takewhile_function_gen.<locals>.geng  r5   r6   c                     | dk  S rX  r(   r   s    r   r   z7ItertoolsTest.test_takewhile_function_gen.<locals>.predl  r   r3   r   r   rY  r   r   r   r   r   r4   r   r   r   s        r   test_takewhile_function_genz)ItertoolsTest.test_takewhile_function_gene       	
	 ]]4' 	4A388B</3	412 	((2,	 	 0	 	r   c                 D  K   d }t        j                  |t              }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                    K   | dk  S wrX  r(   r   s    r   r   z9ItertoolsTest.test_takewhile_coroutine_list.<locals>.predw  r,   r-   r   r]  r   s       r   test_takewhile_coroutine_listz+ItertoolsTest.test_takewhile_coroutine_listu  r   r   c                 L  K   d }d }t        j                  | |             }dD ]/  }| j                  t        j                  |       d {   |       1 | j	                  t
              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc               3   $   K   d d d y wr!  r(   r(   r3   r   r4   z7ItertoolsTest.test_takewhile_coroutine_gen.<locals>.gen  s     GGGr   c                    K   | dk  S wrX  r(   r   s    r   r   z8ItertoolsTest.test_takewhile_coroutine_gen.<locals>.pred  r,   r-   r   rb  rc  s        r   test_takewhile_coroutine_genz*ItertoolsTest.test_takewhile_coroutine_gen  re  r   c                   K   t        j                  t        dz        \  }}t        dz  D ]  }t        j                  t        j
                  |      t        j
                  |             d {   \  }}| j                  ||       | j                  ||       | j                  ||        ||fD ]=  }| j                  t              5  t        j
                  |       d {    d d d        ? y 7 7 # 1 sw Y   NxY wwr   	r   teer^   asynciogatherr   r   r   r   )r   it1it2r   r*   r+   r   s          r   test_tee_list_twozItertoolsTest.test_tee_list_two  s     77519%S 	#A sxx}EEDAqQ"Q"Q"		#
 * 	#B""#56 #hhrl""# #	#	 F ## #s=   A+D-C2.AD	C6"C4#C6'D4C66C?	;Dc           	        K   t        j                  t        dz  d      }t        dz  D ]V  }t        j                  |D cg c]  }t        j
                  |       c}  d {   }|D ]  }| j                  ||        X |D ]=  }| j                  t              5  t        j
                  |       d {    d d d        ? y c c}w 7 g7 # 1 sw Y   SxY ww)Nr!   r   nrn  )r   itrsr   r   rD   rE   s         r   test_tee_list_sixzItertoolsTest.test_tee_list_six  s     wwuqyA& 	+A">>4+HRCHHRL+HIIF +  *+	+  	#B""#56 #hhrl""# #	# ,II
 ## #sG   >C C
C#C$9CC6C7C;CCC	Cc                   K   d }t        j                   |             \  }}dD ]  }t        j                  t        j                  |      t        j                  |             d {   \  }}| j                  ||       | j                  ||       | j                  ||        ||fD ]=  }| j                  t              5  t        j                  |       d {    d d d        ? y 7 7 # 1 sw Y   NxY ww)Nc                 4   K   d d d d y wNr   r	   rc      r(   r(   r3   r   r4   z+ItertoolsTest.test_tee_gen_two.<locals>.gen       GGGHr
  r   r	   rc   r}  r   ro  rp  rq  r   r   r   r   )r   r4   rr  rs  r   r*   r+   r   s           r   test_tee_gen_twozItertoolsTest.test_tee_gen_two  s     	 7735>S 	#A sxx}EEDAqQ"Q"Q"		#
 * 	#B""#56 #hhrl""# #	#	 F ## #s=   A%C<'C,(AC<C0C.C0!C<.C00C9	5C<c           	        K   d }t        j                   |       d      }dD ]V  }t        j                  |D cg c]  }t        j                  |       c}  d {   }|D ]  }| j                  ||        X |D ]=  }| j                  t              5  t        j                  |       d {    d d d        ? y c c}w 7 g7 # 1 sw Y   SxY ww)Nc                 4   K   d d d d y wr|  r(   r(   r3   r   r4   z+ItertoolsTest.test_tee_gen_six.<locals>.gen  r~  r
  r   rv  r  r  )r   r4   rx  r   r   rD   rE   s          r   test_tee_gen_sixzItertoolsTest.test_tee_gen_six  s     	 wwsu" 	+A">>4+HRCHHRL+HIIF +  *+	+  	#B""#56 #hhrl""# #	# ,II
 ## #sF   8CC 
CC9CC	0C1C	5CC		C	Cc                   K    G d dt               fd}d }t        j                   |             \  }}t        j                   ||       ||      d       d {   }|D ]  }| j                  |        y 7 w)Nc                       e Zd Zy);ItertoolsTest.test_tee_propagate_exception.<locals>.MyErrorN)__name__
__module____qualname__r(   r3   r   MyErrorr    s    r3   r  c                 $   K   d d  w)Nr   r!   r(   )r  s   r   r4   z7ItertoolsTest.test_tee_propagate_exception.<locals>.gen  s     GGMs   c                 :   K   d}| 2 3 d {   }||z  }7 
6 |S wr   r(   )r   rU   items      r   consumerz<ItertoolsTest.test_tee_propagate_exception.<locals>.consumer  s0     F   d$bMs   T)return_exceptions)	Exceptionr   ro  rp  rq  assertIsInstance)r   r4   r  rr  rs  rD   rE   r  s          @r   test_tee_propagate_exceptionz*ItertoolsTest.test_tee_propagate_exception  s|     	i 		
	 7735>S~~SMSM"
 
  	2E!!%1	2
s   AB A> B c                 b  K   t        d      }t        d      }t        j                  ||      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nr   rK   ))r   r   )r   r   )r!   r!   rX  )Nr	   re   r   zip_longestr   r   r   r   )r   r*   r+   r   r   s        r   test_zip_longest_rangez$ItertoolsTest.test_zip_longest_range  s     !H!H__Q"? 	4A388B</3	412 	((2,	 	 0	 	s<   AB/B
 B/8B#B!B#
B/!B##B,(B/c                 d  K   d } |       }t        d      }t        j                  ||d      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t              5  t        j                  |       d {    d d d        y 7 G7 # 1 sw Y   y xY ww)Nc                 4   K   d d d d y wr|  r(   r(   r3   r   r4   z5ItertoolsTest.test_zip_longest_fillvalue.<locals>.gen  r~  r
  rK   r   )	fillvalue))r   r   )r	   r   )rc   r!   )r}  r   )r   r	   r  r   r4   r*   r+   r   r   s         r   test_zip_longest_fillvaluez(ItertoolsTest.test_zip_longest_fillvalue  s     	 E!H__QR0; 	4A388B</3	412 	((2,	 	 0	 	r;   c                 v  K   d } |       }t        j                  d      }t        j                  ||      }dD ]/  }| j                  t        j                  |       d {   |       1 | j                  t        d      5  t        j                  |       d {    d d d        y 7 H7 # 1 sw Y   y xY ww)Nc                 4   K   d d t        d      w)Nr   r!   
fake error)r  r(   r3   r   r4   z5ItertoolsTest.test_zip_longest_exception.<locals>.gen	  s     GGL))r
  rK   ))r   rK   )r!   rK   r  )r   r-  r  r   r   rY   r  r  s         r   test_zip_longest_exceptionz(ItertoolsTest.test_zip_longest_exception  s     	*
 EJJqM__Q"! 	4A388B</3	4##I|< 	((2,	 	 0	 	s<   AB9 B)
!!B9B-B+B- 
B9+B--B62B9N)Gr  r  r  r   r   r$   r.   r:   r?   rF   rV   r[   r_   rj   rn   rt   rw   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  rB  rK  rQ  rU  rZ  r^  rd  rh  rl  rt  ry  r  r  r  r  r  r  r(   r3   r   r   r      s>         
 
   % % - - N N   	 	 	 	           4 4
 4 4
 4 4
 4 4
 4 4
 4 4 % %                 	 	 	 	 ; ;   % %         0 0     - -   
 
   	 	 4 4
   
 
   
 
   % %         
# 
# 	# 	# # #$ # #" 2 24 	 	  "  r3   r   )rp  r"   unittestr   aioitertoolsr   helpersr   r^   re   r   r   r(   r3   r   <module>r     s4        	q!GH Gr3   