
    'wfV                     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        ZDyB)C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      p/home/panchajanya/Development/work/volatility3/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                 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_listsP   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>.genZ   "     1a^    r   r   r   r!   r	   r   r8   )r   rH   rI   r   r   r   r   r9   s       r   test_chain_list_gensz"ItertoolsTest.test_chain_list_gensX   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rM   rO   rQ   s    r   r4   z3ItertoolsTest.test_chain_from_iterable.<locals>.genf   rR   rS   rT   )r   rH   from_iterablerI   r   r   r   r   r9   s       r   test_chain_from_iterablez&ItertoolsTest.test_chain_from_iterabled   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rM   rO   rQ   s    r   r4   zKItertoolsTest.test_chain_from_iterable_parameter_expansion_gen.<locals>.genr   rR   rS   c                 4   K   t                    y wr'   rI   )r4   s   r   parameters_genzVItertoolsTest.test_chain_from_iterable_parameter_expansion_gen.<locals>.parameters_genv   s     K%Ks   rT   )r   rH   rX   r   r   r   r   )r   r^   r   r   r4   s       @r   0test_chain_from_iterable_parameter_expansion_genz>ItertoolsTest.test_chain_from_iterable_parameter_expansion_genp   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   )r   r!   r   )r   combinationsrP   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_replacementrI   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   )rP   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   cyclerj   r   r   r   r   rk   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|   +   ,   -   rx   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   rx   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)N)step)r   r   irx   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   ru   rI   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   ru   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   results      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   r!   r   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-   r   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>.pred!  s     q5A:s   	r   r   r   s       r   test_filterfalse_coroutine_listz-ItertoolsTest.test_filterfalse_coroutine_list  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   rl   r   r   s       r   test_groupby_listzItertoolsTest.test_groupby_list*  s     [[(3c
*;cC5\J 	4A388B</3	412 	((2,	 	 0	 	ro   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_key4  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>.gen@           r*   r   r+   r   r9   s       r   test_groupby_genzItertoolsTest.test_groupby_gen>  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>.genL  r   r   r   r*   r   r+   r   r   r   r9   s       r   test_groupby_gen_keyz"ItertoolsTest.test_groupby_gen_keyJ  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   rO   )_s    r   r4   z-ItertoolsTest.test_groupby_empty.<locals>.genX  s     1X s   z!No iteration should have happened)r   r   fail)r   r4   r   s      r   test_groupby_emptyz ItertoolsTest.test_groupby_emptyV  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	   )assertRaisesRegex
ValueErrorr   islice)r   r   s     r   test_islice_bad_rangez#ItertoolsTest.test_islice_bad_range_  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)N   r   )r   r   rP   rB   r   rC   s      r   test_islice_stop_zeroz#ItertoolsTest.test_islice_stop_zeroi  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_stopp  s     ZZ" 	4A388B</3	412 	((2,	 	 0	 	rg   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_stepx  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   r   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!   r!   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   r   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	 	rc   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!   r   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   r   )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	 	rc   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	 	rg   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	 	ro   c                    K   t        j                  d      }dgdz  D ]/  }| j                  t        j                  |       d {   |       1 y 7 w)Nr|   ri   )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|   r   )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	 	rg   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rI   r   starmapr   r   r   r   r   rl   r+  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   r]   r(   r3   r   r4   z4ItertoolsTest.test_starmap_function_gen.<locals>.gen  s!     )O)OKs    "c                  $    dj                  |       S r%  r'  r)  s    r   r+  z7ItertoolsTest.test_starmap_function_gen.<locals>.concat  r,  r3   r-  r   r2  r   r   r   r   r   r4   r+  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r%  r'  r)  s    r   r+  z9ItertoolsTest.test_starmap_coroutine_list.<locals>.concat$       774=    r-  r1  r3  s        r   test_starmap_coroutine_listz)ItertoolsTest.test_starmap_coroutine_list   r5  r6  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r9  r]   r(   r3   r   r4   z5ItertoolsTest.test_starmap_coroutine_gen.<locals>.gen/  s!     )O)OKs   #%c                  ,   K   dj                  |       S wr%  r'  r)  s    r   r+  z8ItertoolsTest.test_starmap_coroutine_gen.<locals>.concat4  rA  rB  r-  r;  r<  s        r   test_starmap_coroutine_genz(ItertoolsTest.test_starmap_coroutine_gen-  r>  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>.pred?  r   r3   )r   r   	takewhiler   )r   r   rD   s      r   test_takewhile_emptyz"ItertoolsTest.test_takewhile_empty=  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 rJ  r(   r   s    r   r   z8ItertoolsTest.test_takewhile_function_list.<locals>.predG  r   r3   r   r   rK  r   r   r   r   r   r   s       r   test_takewhile_function_listz*ItertoolsTest.test_takewhile_function_listE  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>.genR  r5   r6   c                     | dk  S rJ  r(   r   s    r   r   z7ItertoolsTest.test_takewhile_function_gen.<locals>.predW  r   r3   r   r   rK  r   r   r   r   r   r4   r   r   r   s        r   test_takewhile_function_genz)ItertoolsTest.test_takewhile_function_genP       	
	 ]]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rJ  r(   r   s    r   r   z9ItertoolsTest.test_takewhile_coroutine_list.<locals>.predb  r,   r-   r   rO  r   s       r   test_takewhile_coroutine_listz+ItertoolsTest.test_takewhile_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               3   $   K   d d d y wr  r(   r(   r3   r   r4   z7ItertoolsTest.test_takewhile_coroutine_gen.<locals>.genm  s     GGGr   c                    K   | dk  S wrJ  r(   r   s    r   r   z8ItertoolsTest.test_takewhile_coroutine_gen.<locals>.predr  r,   r-   r   rT  rU  s        r   test_takewhile_coroutine_genz*ItertoolsTest.test_takewhile_coroutine_genk  rW  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   teerI   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   nr`  )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	   rN      r(   r(   r3   r   r4   z+ItertoolsTest.test_tee_gen_two.<locals>.gen       GGGHr   r   r	   rN   ro  r   ra  rb  rc  r   r   r   r   )r   r4   rd  re  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rn  r(   r(   r3   r   r4   z+ItertoolsTest.test_tee_gen_six.<locals>.gen  rp  r   r   rh  rq  rr  )r   r4   rj  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   MyErrorry    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   r   items      r   consumerz<ItertoolsTest.test_tee_propagate_exception.<locals>.consumer  s0     F   d$bMs   T)return_exceptions)	Exceptionr   ra  rb  rc  assertIsInstance)r   r4   r  rd  re  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   r   ))r   r   )r   r   )r!   r!   rJ  )Nr	   rP   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rn  r(   r(   r3   r   r4   z5ItertoolsTest.test_zip_longest_fillvalue.<locals>.gen  rp  r   r   r|   )	fillvalue))r   r   )r	   r   )rN   r!   )ro  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   r   ))r   r   )r!   r   r  )r   r  r  r   r   r   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)Erz  r{  r|  r   r   r$   r.   r:   r?   rF   rJ   rU   rY   r_   rb   rf   rn   rv   rz   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"  r4  r=  rC  rG  rL  rP  rV  rZ  r^  rf  rk  rs  rv  r  r  r  r  r(   r3   r   r   r      s         
 
   % %   	 	 	 	           4 4
 4 4
 4 4
 4 4
 4 4
 4 4 % %                 	 	 	 	 ; ;   % %         0 0     - -   
 
   	 	 4 4
   
 
   
 
   % %         
# 
# 	# 	# # #$ # #" 2 24 	 	  "  r3   r   )rb  r"   unittestr   aioitertoolsr   helpersr   rI   rP   r   r   r(   r3   r   <module>r     s4        	q!rH rr3   