+
    BiZ[                        R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHtHt ^ RIH	t	 ]P                  ! RR.R7      t]P                  ! RR.R7      t. R2Ot]] U u. uF  q R	,           NK  	  up ,          t ! R
 R]4      tR t ! R R4      t ! R R]]4      t]! ]R4       ! R R]]4      4       t ! R R4      t ! R R4      tR t ! R R4      t ! R R4      t ! R R4      t ! R R 4      t ! R! R"4      t ! R# R$4      t ! R% R&4      t^ R'IHt R( t ! R) R*4      t  ! R+ R,4      t! ! R- R.]!]4      t"]! ]R4       ! R/ R0]!]4      4       t#]$R18X  d   ]PJ                  ! 4        R# R# u up i )3zUnittests for heapq.N)import_helper)TestCase
skipUnless)
itemgetterheapq_heapq)blocked)fresh_maxc                   D   a  ] tR t^t o R t]! ]R4      R 4       tRtV t	R# )TestModulesc                t    \          F-  pV P                  \        \        V4      P                  R 4       K/  	  R# )r   N)
func_namesassertEqualgetattrpy_heapq
__module__selffnames   & &/usr/lib/python3.14/test/test_heapq.pytest_py_functionsTestModules.test_py_functions   s)    EWXu5@@'J      requires _heapqc                v    \          F.  pV P                  \        \        V4      P                  R V4       K0  	  R# )r   N)r   r   r   c_heapqr   r   s   & r   test_c_functionsTestModules.test_c_functions   s+    EWWe4??5Q  r    N)
__name__r   __qualname____firstlineno__r   r   r   r   __static_attributes____classdictcell____classdict__s   @r   r   r      s)     K *+R ,Rr   r   c                 z     ! R  R4      pVP                  \        P                  ! \        V! 4       R7      4       V# )c                   &   a  ] tR t^'t o R tRtV tR# )+load_tests.<locals>.HeapqMergeDocTestFinderc                j    \         P                  ! 4       pVP                  \        P                  4      # N)doctestDocTestFinderfindr   merge)r   argskwargsdtfs   &*, r   r.   0load_tests.<locals>.HeapqMergeDocTestFinder.find(   s#    '')C88HNN++r   r   N)r    r   r!   r"   r.   r#   r$   r%   s   @r   HeapqMergeDocTestFinderr)   '   s     	, 	,r   r4   )test_finder)addTestsr,   DocTestSuiter   )loadertestsignorer4   s   &&& r   
load_testsr;      s6    , ,
 
NN7''4K4MO PLr   c                      a  ] tR t^0t o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRt V t!R# )TestHeapc                *   . p. pV P                  V4       \        R 4       FU  p\        P                  ! 4       pVP                  V4       V P                  P                  W4       V P                  V4       KW  	  . pV'       d@   V P                  P                  V4      pV P                  V4       VP                  V4       KG  VR,          pVP                  4        V P                  We4       V P                  V4       V P                  \        V P                  P
                  . 4        V P                  \        V P                  P
                  RR4       V P                  \        V P                  P                  R4       R#   \         d     R# i ; i)   NNNN)check_invariantrangerandomappendmoduleheappushheappopsortr   assertRaises	TypeErrorAttributeError)r   heapdataiitemresultsdata_sorteds   &      r   test_push_popTestHeap.test_push_pop2   s5   T"sA==?DKKKK  ,  &	 
 ;;&&t,D  &NN4 1g.W%)T[[%9%92>	i)=)=tTJi)<)<dC 		s   *AF FFc                   . p. pV P                  V4       \        R 4       FU  p\        P                  ! 4       pVP                  V4       V P                  P                  W4       V P                  V4       KW  	  . pV'       d@   V P                  P                  V4      pV P                  V4       VP                  V4       KG  VR,          pVP                  RR7       V P                  We4       V P                  V4       V P                  \        V P                  P
                  . 4       \        \        3pV P                  WpP                  P
                  RR4       V P                  WpP                  P                  R4       R# )r?   r@   TreverseN)check_max_invariantrB   rC   rD   rE   heappush_maxheappop_maxrH   r   rI   rJ   rK   )r   rL   rM   rN   rO   rP   rQ   	exc_typess   &       r   test_max_push_popTestHeap.test_max_push_popN   s)     &sA==?DKKKK$$T0$$T*	 
 ;;**40D$$T*NN4 1g&.  ))T[[%=%=rB#Y/	)[[%=%=tTJ)[[%<%<dCr   c                    \        V4       F9  w  r#V'       g   K  V^,
          ^,	          pV P                  W,          V8*  4       K;  	  R#    N)	enumerate
assertTruer   rL   posrO   	parentposs   &&   r   rA   TestHeap.check_invariantj   s7    "4ICs UqL	4 78 )r   c                    \        VR ,          ^R7       F-  w  r#V^,
          ^,	          pV P                  W,          V4       K/  	  R# ):r_   NN)startN)r`   assertGreaterEqualrb   s   &&   r   rW   TestHeap.check_max_invariantq   s8    "4815ICqQI##DOT: 6r   c                ^   \        \        ^4      4      R.,            F\  p\        V4       Uu. uF  p\        P                  ! 4       NK  	  ppV P                  P	                  V4       V P                  V4       K^  	  V P                  \        V P                  P                  R4       R# u upi     N  N)listrB   rC   rE   heapifyrA   rI   rJ   r   sizedummyrL   s   &   r   test_heapifyTestHeap.test_heapifyv   s    rOug--D16t=FMMOD=KK%  & .
 	)T[[%8%8$?	 >   B*c                ^   \        \        ^4      4      R.,            F\  p\        V4       Uu. uF  p\        P                  ! 4       NK  	  ppV P                  P	                  V4       V P                  V4       K^  	  V P                  \        V P                  P                  R4       R# u upi rk   )rn   rB   rC   rE   heapify_maxrW   rI   rJ   rp   s   &   r   test_heapify_maxTestHeap.test_heapify_max~   s    rOug--D16t=FMMOD=KK##D)$$T* .
 	)T[[%<%<dC	 >ru   c                n   \        R 4       Uu. uF  p\        P                  ! R4      NK  	  pp. pV FK  pV P                  P	                  W44       \        V4      ^
8  g   K0  V P                  P                  V4       KM  	  VP                  4        V P                  V\        V4      RR 4       R# u upi )    N)
rB   rC   	randrangerE   rF   lenrG   rH   r   sortedr   rN   rM   rL   rO   s   &    r   test_naive_nbestTestHeap.test_naive_nbest   s    05d<1  &<DKK  ,4y2~##D)  			vd|CD12 =s   B2c              #  p   "     V P                   P                  V4      x  K     \         d     R# i ; i5ir^   )rE   rG   
IndexErrorr   rL   s   &&r   heapiterTestHeap.heapiter   s3     	kk))$// 		   6 $ 3636c                   \        R 4       Uu. uF  p\        P                  ! R4      NK  	  ppVR,          pV P                  P	                  V4       VR,           F-  pWC^ ,          8  g   K  V P                  P                  W44       K/  	  V P                  \        V P                  V4      4      \        V4      RR 4       V P                  \        V P                  P
                  R4       V P                  \        V P                  P
                  RR4       V P                  \        V P                  P
                  . R4       R# u upi )r{   r|   N
   Nr   NNNr}   )rB   rC   r~   rE   ro   heapreplacer   rn   r   r   rI   rJ   r   r   s   &    r   
test_nbestTestHeap.test_nbest   s     16d<1  &<CyD!IID1g~''3  	dmmD12F4L4FG)T[[%<%<dC)T[[%<%<dDI*dkk&=&=r4H =s   Ec                ~   \        R 4       Uu. uF  p\        P                  ! R4      NK  	  ppVR,          pV P                  P	                  V4       \        ^
4       Uu. uF  q@P                  P                  V4      NK  	  ppVP                  4        V P                  V\        V4      RR 4       R# u upi u upi )r{   r|   r@   Nr}   )	rB   rC   r~   rE   rw   rY   rV   r   r   )r   rN   rM   rL   _results   &     r   test_nbest_maxheapTestHeap.test_nbest_maxheap   s     16d<1  &<Aw%9>rCA++))$/Ccd!34 = Ds   B5 #B:c                   \        R 4       Uu. uF  p\        P                  ! R4      NK  	  ppVR,          pV P                  P	                  V4       VR,           F  pV P                  P                  W44       K   	  V P                  \        V P                  V4      4      \        V4      RR 4       V P                  V P                  P                  . R4      R4       R# u upi )r{   r|   r   r   Nxr}   )
rB   rC   r~   rE   ro   heappushpopr   rn   r   r   r   s   &    r   test_nbest_with_pushpop TestHeap.test_nbest_with_pushpop   s    05d<1  &<CyD!IIDKK##D/ dmmD12F4L4FG00S93? =s   C"c                x   \        R 4       Uu. uF  p\        P                  ! R4      NK  	  pp. pV FK  pV P                  P	                  W44       \        V4      ^
8  g   K0  V P                  P                  V4       KM  	  VP                  4        \        V4      R,          pV P                  W54       R# u upi )r{   r|   r   N)
rB   rC   r~   rE   rX   r   rY   rH   r   r   r   rN   rM   rL   rO   expecteds   &     r   test_naive_nworstTestHeap.test_naive_nworst   s    05d<1  &<DKK$$T04y2~''-  			$<$( =s   B7c              #  p   "     V P                   P                  V4      x  K     \         d     R# i ; i5ir^   )rE   rY   r   r   s   &&r   heapiter_maxTestHeap.heapiter_max   s3     	kk--d33 		r   c                   \        R 4       Uu. uF  p\        P                  ! R4      NK  	  ppVR,          pV P                  P	                  V4       VR,           F-  pWC^ ,          8  g   K  V P                  P                  W44       K/  	  \        VRR7      RR pV P                  \        V P                  V4      4      V4       V P                  \        V P                  P
                  R4       V P                  \        V P                  P
                  RR4       V P                  \        V P                  P
                  . R4       R# u upi )r{   r|   r   r   TrU   Nr}   )rB   rC   r~   rE   rw   heapreplace_maxr   r   rn   r   rI   rJ   r   r   s   &     r   test_nworstTestHeap.test_nworst   s    05d<1  &<Cy%IID1g~++D7  $-cd3d//56A)T[[%@%@$G)T[[%@%@$M*dkk&A&A2tL =s   Ec                   \        R 4       Uu. uF  p\        P                  ! R4      NK  	  ppVR,          pV P                  P	                  V4       \        ^
4       Uu. uF  q@P                  P                  V4      NK  	  ppVP                  4        \        VRR7      RR pV P                  WV4       R# u upi u upi )r{   r|   r@   TrU   Nr}   )	rB   rC   r~   rE   ro   rG   rV   r   r   )r   rN   rM   rL   r   r   r   s   &      r   test_nworst_minheapTestHeap.test_nworst_minheap   s    05d<1  &<AwD!5:2Y?Y++%%d+Y?$-cd3* = @s   B8 #B=c                   \        R 4       Uu. uF  p\        P                  ! R4      NK  	  ppVR,          pV P                  P	                  V4       VR,           F  pV P                  P                  W44       K   	  \        VRR7      RR pV P                  \        V P                  V4      4      V4       V P                  V P                  P                  . R4      R4       R# u upi )	r{   r|   r   r   TrU   Nr   r}   )
rB   rC   r~   rE   rw   heappushpop_maxr   r   rn   r   r   s   &     r   test_nworst_with_pushpop!TestHeap.test_nworst_with_pushpop   s    05d<1  &<Cy%IIDKK''3 $-cd3d//56A44R=sC =s   C&c                4   . pV P                   P                  V^
4      pV P                  W3. ^
34       ^
.pV P                   P                  VR4      pV P                  W3^
.R34       V P                  \        V^ ,          4      \        4       V P                  \        V4      \
        4       ^
.pV P                   P                  V^	4      pV P                  W3^
.^	34       ^
.pV P                   P                  V^4      pV P                  W3^.^
34       R# r   g      $@N)rE   r   r   typeintfloatr   hr   s   &  r   test_heappushpopTestHeap.test_heappushpop   s    KK##Ar*!"b*DKK##At,!2$.adS)a%(DKK##Aq)!2$+DKK##Ar*!2$,r   c                   . pV P                   P                  V^
4      pV P                  W3. ^
34       ^
.pV P                   P                  VR4      pV P                  W3^
.R34       V P                  V^ ,          \        4       V P                  V\
        4       ^
.pV P                   P                  V^4      pV P                  W3^
.^34       ^
.pV P                   P                  V^	4      pV P                  W3^	.^
34       R# r   )rE   r   assertTupleEqualassertIsInstancer   r   r   s   &  r   test_heappushpop_maxTestHeap.test_heappushpop_max  s    KK''2.qfr2h/DKK''40qftTl3adC(a'DKK''2.qftRj1DKK''1-qfsBi0r   c                    ^^.pV P                  V P                  P                  V4      ^4       V P                  V P                  P                  V4      ^4       R#    N)r   rE   rY   )r   r   s   & r   test_heappop_maxTestHeap.test_heappop_max  sK     F003Q7003Q7r   c                   \        ^d4       F  p\        P                  ! ^24      p\        V4       Uu. uF  p\        P                  ! ^4      NK  	  ppV^,          '       d&   VR,          pV P                  P	                  V4       M&. pV F  pV P                  P                  WV4       K   	  \        V4       Uu. uF  q0P                  P                  V4      NK  	  ppV P                  V\        V4      4       K  	  R# u upi u upi )d   r@   N)	rB   rC   r~   rE   ro   rF   rG   r   r   r   trialrq   rN   rM   rL   rO   heap_sorteds   &       r   test_heapsortTestHeap.test_heapsort   s    3ZE##B'D27+>+QF$$R(+D>qyyAw##D) DKK((4 !>CDkJk;;..t4kKJ[&,7  > Ks   D :#Dc           	        \        ^d4       F  p\        P                  ! ^24      p\        V4       Uu. uF  p\        P                  ! ^4      NK  	  ppV^,          '       d&   VR,          pV P                  P	                  V4       M&. pV F  pV P                  P                  WV4       K   	  \        V4       Uu. uF  q0P                  P                  V4      NK  	  ppV P                  V\        VRR7      4       K  	  R# u upi u upi )r   r@   TrU   N)	rB   rC   r~   rE   rw   rX   rY   r   r   r   s   &       r   test_heapsort_maxTestHeap.test_heapsort_max/  s    3ZE##B'D27+>+QF$$R(+D>qyyAw''- DKK,,T8 !BG+N+Q;;2248+KN[&t*DE  > Os   D:#Dc                   . p\        \        P                  ! ^4      4       Fz  p. p\        \        P                  ! ^d4      4       FA  p\        P                  ! R4      \        P                  ! RR4      3pVP	                  V4       KC  	  VP	                  V4       K|  	  R\        ^ 4      \        ^4      \        ^^ 4      3 F  pR F  p. pV F  p	VP	                  \        WVR7      4       K!  	  V P                  \        \        V!  WgR7      \        V P                  P                  ! VRVRV/ 4      4       V P                  \        V P                  P                  4       4      . 4       K  	  K  	  R# )	   ABC  NkeyrV   r   rV   i)FT)rB   rC   r~   choicerD   r   r   r   chainrn   rE   r/   )
r   inputsrN   rowjtupr   rV   seqsseqs
   &         r   
test_mergeTestHeap.test_merge=  s*   v''+,AC6++C01mmE*F,<,<T3,GG

3 2 MM# - *Q-A
1a8HIC(!CKKsW EF "  vC!Q!%dkk&7&7&X3&XPW&X!Y[  dkk&7&7&9!:B? ) Jr   c           
         V P                  \        V P                  P                  . . 4      4      . 4       V P                  \        V P                  P                  . . R  R7      4      . 4       R# )c                      ^# )   r   r   r   r   <lambda>,TestHeap.test_empty_merges.<locals>.<lambda>S  s    Ar   r   N)r   rn   rE   r/   r   s   &r   test_empty_mergesTestHeap.test_empty_mergesO  sU     	dkk//B78"=dkk//BI/FGLr   c           	         R  pV P                  \        4      ;_uu_ 4        \        V P                  P	                  V! 4       V! 4       4      4       RRR4       R#   + '       g   i     R# ; i)c               3   n   "   \        \        ^
4      4      p \        ^4       F  pW,          x  K  	  R# 5ir   N)rn   rB   )srN   s     r   iterableCTestHeap.test_merge_does_not_suppress_index_error.<locals>.iterableW  s'     U2YA2Yd
 s   35N)rI   r   rn   rE   r/   )r   r   s   & r   (test_merge_does_not_suppress_index_error1TestHeap.test_merge_does_not_suppress_index_errorU  sF    	 z**""8:xz:; +***s   0AA,	c                    ! R  R\         4      p. . . . .p\        R4       FV  p\        P                  ! ^4      p\        P                  ! R4      pV! V4      pWT3Vn        W$,          P                  V4       KX  	  V F  pVP                  4        K  	  V P                  P                  ! V!   Uu. uF  q3P                  NK  	  ppV P                  V\        V4      4       R# u upi )c                       ] tR tRtRtR# )*TestHeap.test_merge_stability.<locals>.Inti_  r   N)r    r   r!   r"   r#   r   r   r   Intr   _  s    r   r   rm   r   N)r   rB   rC   r~   pairrD   rH   rE   r/   r   r   )r   r   r   rN   streamr   objr   s   &       r   test_merge_stabilityTestHeap.test_merge_stability^  s    	# 	b"b!uA%%a(F  %Aa&C{CHN!!#&  FKKM "&++"3"3V"<="<Q&&"<=0 >s   0C#c                   \        R 4       Uu. uF  p\        P                  ! R4      V3NK  	  ppRR 3 F  pR F  pV P                  \	        V P
                  P                  WB4      4      \        V4      RV 4       V P                  \	        V P
                  P                  WBVR7      4      \        W#R7      RV 4       K  	  K  	  R# u upi )r{   r|   Nc                 0    V ^ ,          R,          R,          #     i#  r|   r   r   s   &r   r   )TestHeap.test_nsmallest.<locals>.<lambda>o      1Q4#:#4r   r   	r   r_      r   r   i  i  r{   iL  )rB   rC   r~   r   rn   rE   	nsmallestr   r   rN   rM   fns   &    r   test_nsmallestTestHeap.test_nsmallestm  s    5:4[A[!!$'+[A45A=  dkk&;&;A&D!E!'bq!13  dkk&;&;A&;&K!L!'!4Ra!8: > 6 Bs   !Cc                   \        R 4       Uu. uF  p\        P                  ! R4      V3NK  	  ppRR 3 F  pR F  pV P                  \	        V P
                  P                  WB4      4      \        VRR7      RV 4       V P                  \	        V P
                  P                  WBVR7      4      \        W#RR7      RV 4       K  	  K  	  R# u upi )	r{   r|   Nc                 0    V ^ ,          R,          R,          # r   r   r   s   &r   r   (TestHeap.test_nlargest.<locals>.<lambda>x  r   r   TrU   r   r   r   )rB   rC   r~   r   rn   rE   nlargestr   r   s   &    r   test_nlargestTestHeap.test_nlargestv  s    5:4[A[!!$'+[A45A=  dkk&:&:1&C!D!'d!;BQ!?A  dkk&:&:1&:&J!K!'T!B2A!FH > 6 Bs   !Cc                  a  V 3R  lp ! R R4      p ! R R4      p\        ^d4       Uu. uF  p\        P                  ! 4       NK  	  pp\        VRR7      pS P                  V! WR4      V4       S P	                  \
        WS4       R# u upi )c                   < V  Uu. uF
  q!! V4      NK  	  p pSP                   P                  V 4       \        \        V 4      4       Uu. uF(  pSP                   P	                  V 4      P
                  NK*  	  up# u upi u upi r+   )rE   ro   rB   r   rG   r   )rM   compr   rN   r   s   &&  r   hsort0TestHeap.test_comparison_operator.<locals>.hsort  sj    %)*TDGTD*KK%9>s4y9IJ9IADKK''-//9IJJ +Js   A:	.A?c                   ,   a  ] tR tRt o R tR tRtV tR# )-TestHeap.test_comparison_operator.<locals>.LTi  c                    Wn         R # r+   r   r   r   s   &&r   __init__6TestHeap.test_comparison_operator.<locals>.LT.__init__      r   c                4    V P                   VP                   8  # r+   r   r   others   &&r   __lt__4TestHeap.test_comparison_operator.<locals>.LT.__lt__  s    vv''r   r   Nr    r   r!   r"   r  r  r#   r$   r%   s   @r   LTr    s     ( (r   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )-TestHeap.test_comparison_operator.<locals>.LEi  c                    Wn         R # r+   r   r  s   &&r   r  6TestHeap.test_comparison_operator.<locals>.LE.__init__  r  r   c                4    V P                   VP                   8  # r+   r   r  s   &&r   __le__4TestHeap.test_comparison_operator.<locals>.LE.__le__  s    vv((r   r   N)r    r   r!   r"   r  r"  r#   r$   r%   s   @r   LEr    s     ) )r   r$  TrU   N)rB   rC   r   r   rI   rJ   )r   r  r  r$  rN   rM   targets   f      r   test_comparison_operator!TestHeap.test_comparison_operator  sr    	K	( 	(
	) 	)
 */s4A4d+t&1)T. 5s   Br   N)"r    r   r!   r"   rR   r[   rA   rW   rs   rx   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%   s   @r   r=   r=   0   s     8D89;
@D3I	5@
)M+	D-&1&88F@$M<1:H/ /r   r=   c                       ] tR tRt]tRtR# )TestHeapPythoni  r   Nr    r   r!   r"   r   rE   r#   r   r   r   r)  r)        Fr   r)  r   c                       ] tR tRt]tRtR# )	TestHeapCi  r   Nr    r   r!   r"   r   rE   r#   r   r   r   r-  r-        Fr   r-  c                   *   a  ] tR tRt o RtR tRtV tR# )LenOnlyi  z:Dummy sequence class defining __len__ but not __getitem__.c                    ^
# )r   r   r   s   &r   __len__LenOnly.__len__  s    r   r   N)r    r   r!   r"   __doc__r3  r#   r$   r%   s   @r   r1  r1    s     @ r   r1  c                   >   a  ] tR tRt o RtR t];t;t;t;t	t
RtV tR# )CmpErri  z;Dummy element that always raises an error during comparisonc                    \         hr+   )ZeroDivisionErrorr  s   &&r   __eq__CmpErr.__eq__  s    r   r   N)r    r   r!   r"   r5  r:  __ne__r  r"  __gt____ge__r#   r$   r%   s   @r   r7  r7    s&     A 177F7V7f7vr   r7  c              #  (   "   V  F  pVx  K	  	  R# 5i)zRegular generatorNr   seqnrN   s   & r   RrB    s      s   c                   0   a  ] tR tRt o RtR tR tRtV tR# )Gi  zSequence using __getitem__c                    Wn         R # r+   rA  r   rA  s   &&r   r  
G.__init__  s    	r   c                (    V P                   V,          # r+   rF  )r   rN   s   &&r   __getitem__G.__getitem__  s    yy|r   rF  N)	r    r   r!   r"   r5  r  rJ  r#   r$   r%   s   @r   rD  rD    s       r   rD  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )Ii  z Sequence using iterator protocolc                     Wn         ^ V n        R# r   Nr@  rG  s   &&r   r  
I.__init__      	r   c                    V # r+   r   r   s   &r   __iter__
I.__iter__      r   c                    V P                   \        V P                  4      8  d   \        hV P                  V P                   ,          pV ;P                   ^,          un         V# r_   rN   r   rA  StopIterationr   vs   & r   __next__
I.__next__  ?    66S^#=%8IIdff!r   rN   rA  N
r    r   r!   r"   r5  r  rS  r\  r#   r$   r%   s   @r   rM  rM    s     & r   rM  c                   0   a  ] tR tRt o RtR tR tRtV tR# )Igi  z9Sequence using iterator protocol defined with a generatorc                     Wn         ^ V n        R# rO  r@  rG  s   &&r   r  Ig.__init__  rQ  r   c              #  <   "   V P                    F  pVx  K	  	  R # 5ir+   rF  )r   vals   & r   rS  Ig.__iter__  s     99CI s   r_  N	r    r   r!   r"   r5  r  rS  r#   r$   r%   s   @r   rb  rb    s     ? r   rb  c                   0   a  ] tR tRt o RtR tR tRtV tR# )Xi  z Missing __getitem__ and __iter__c                     Wn         ^ V n        R# rO  r@  rG  s   &&r   r  
X.__init__  rQ  r   c                    V P                   \        V P                  4      8  d   \        hV P                  V P                   ,          pV ;P                   ^,          un         V# rW  rX  rZ  s   & r   r\  
X.__next__  r^  r   r_  N)	r    r   r!   r"   r5  r  r\  r#   r$   r%   s   @r   rj  rj    s     & r   rj  c                   0   a  ] tR tRt o RtR tR tRtV tR# )Ni  zIterator missing __next__()c                     Wn         ^ V n        R# rO  r@  rG  s   &&r   r  
N.__init__  rQ  r   c                    V # r+   r   r   s   &r   rS  
N.__iter__  rU  r   r_  Nrh  r%   s   @r   rp  rp    s     ! r   rp  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )Ei  zTest propagation of exceptionsc                     Wn         ^ V n        R# rO  r@  rG  s   &&r   r  
E.__init__  rQ  r   c                    V # r+   r   r   s   &r   rS  
E.__iter__  rU  r   c                    ^^ ,           R# r   r   r   s   &r   r\  
E.__next__  s    	Qr   r_  Nr`  r%   s   @r   rv  rv    s     $ r   rv  c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )Si  zTest immediate stopc                    R # r+   r   rG  s   &&r   r  
S.__init__  s    r   c                    V # r+   r   r   s   &r   rS  
S.__iter__  rU  r   c                    \         hr+   )rY  r   s   &r   r\  
S.__next__  s    r   r   Nr`  r%   s   @r   r~  r~    s      r   r~  )r   c                d    \        \        R \        \        \	        V 4      4      4      4      4      # )z Test multiple tiers of iteratorsc                     V # r+   r   r   s   &r   r   L.<locals>.<lambda>  s    ar   )r   maprB  rb  rD  rF  s   &r   Lr    s     Z2ag;011r   c                   ,   a  ] tR tRt o R tR tRtV tR# )SideEffectLTi  c                    Wn         W n        R # r+   )valuerL   )r   r  rL   s   &&&r   r  SideEffectLT.__init__  s    
	r   c                R    . V P                   R &   V P                  VP                  8  # )r@   rL   r  r  s   &&r   r  SideEffectLT.__lt__  s"    		!zzEKK''r   r  Nr  r%   s   @r   r  r    s     ( (r   r  c                   V   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tRtV tR# )TestErrorHandlingi  c                D   V P                   P                  V P                   P                  V P                   P                  V P                   P                  3 F   pV P                  \        \        3V^
4       K"  	  V P                   P                  V P                   P                  V P                   P                  V P                   P                  V P                   P                  V P                   P                  3 F!  pV P                  \        \        3V^
^
4       K#  	  R# r   )rE   ro   rG   rw   rY   rI   rJ   rK   rF   r   rX   r   r  r   r   r   s   & r   test_non_sequence#TestErrorHandling.test_non_sequence  s    ++%%t{{':':++))4;;+B+BDAy.91bAD ++&&(?(?++**DKK,G,G++&&(=(=?A y.91b"E?r   c                   V P                   P                  V P                   P                  V P                   P                  V P                   P                  3 F(  pV P                  \        \        3V\        4       4       K*  	  V P                   P                  V P                   P                  V P                   P                  V P                   P                  3 F)  pV P                  \        \        3V\        4       ^
4       K+  	  V P                   P                  V P                   P                  3 F#  pV P                  \        V^\        4       4       K%  	  R# r   )rE   ro   rG   rw   rY   rI   rJ   rK   r1  rF   r   rX   r   r  r   r  s   & r   test_len_onlyTestErrorHandling.test_len_only  s    ++%%t{{':':++))4;;+B+BDAy.91giHD ++&&(?(?++**DKK,G,GIAy.91giLI ++&&(=(=>AiAwy9 ?r   c                P   \        4       \        4       \        4       .pV P                  P                  V P                  P                  3 F  pV P	                  \
        W!4       K  	  V P                  P                  V P                  P                  V P                  P                  V P                  P                  3 F  pV P	                  \
        W!^
4       K  	  V P                  P                  V P                  P                  3 F  pV P	                  \
        V^V4       K  	  R# r   )r7  rE   ro   rG   rI   r9  rF   r   rX   r   r  r   )r   r   r   s   &  r   test_cmp_errTestErrorHandling.test_cmp_err  s    x68,++%%t{{':':;A/8 <++&&(?(?++**DKK,G,GIA/<I ++&&(=(=>A/As; ?r   c           
        V P                   P                  V P                   P                  V P                   P                  V P                   P                  V P                   P
                  V P                   P                  V P                   P                  V P                   P                  V P                   P                  V P                   P                  3
 F   pV P                  \        \        3V^
4       K"  	  R# r   )rE   ro   rG   rF   r   rw   rY   rX   r   r  r   rI   rJ   rK   r  s   & r   test_arg_parsing"TestErrorHandling.test_arg_parsing#  s    ++%%t{{':':++&&(?(?++))4;;+B+B++**DKK,G,G++&&(=(=	?A
 y.91bA?r   c                   V P                   P                  V P                   P                  3 EF  pR R\        R4      R\        RR^4      3 F  p\        \
        \        \        \        3 F;  pV P                  \        V! ^V! V4      4      4      \        V! ^V4      4      4       K=  	  V P                  \        V! ^\        V4      4      4      . 4       V P                  \        V^\        V4      4       V P                  \        V^\        V4      4       V P                  \         V^\#        V4      4       K  	  EK  	  R# )123 r{   r|   i  N)r_   g333333?)rE   r  r   rB   rD  rM  rb  r  rB  r   rn   r~  rI   rJ   rj  rp  r9  rv  )r   r   r   gs   &   r   test_iterable_args$TestErrorHandling.test_iterable_args+  s    ++&&(=(=>ARthd48JKQAq)A$$T!Aqt*%5tAaF|D *  a1Q4j!126!!)Q1Q48!!)Q1Q48!!"3Q1Q4@ L ?r   c           	     6  a . oSP                  V3R  l\        ^4       4       4       V P                  \        \        34      ;_uu_ 4        V P
                  P                  S\        ^S4      4       RRR4       . oSP                  V3R l\        ^4       4       4       V P                  \        \        34      ;_uu_ 4        V P
                  P                  S\        ^S4      4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c              3   <   <"   T F  p\        VS4      x  K  	  R # 5ir+   r  .0rN   rL   s   & r   	<genexpr>@TestErrorHandling.test_heappush_mutating_heap.<locals>.<genexpr>9       >:aLD)):   Nc              3   <   <"   T F  p\        VS4      x  K  	  R # 5ir+   r  r  s   & r   r  r  >  r  r  )	extendrB   rI   r   RuntimeErrorrE   rF   r  rX   r   s   &@r   test_heappush_mutating_heap-TestErrorHandling.test_heappush_mutating_heap7  s    >5:>>
L9::KK  |At'<= ;>5:>>
L9::KK$$T<4+@A ;:	 ;: ;::s   'C4'D4D	D	c                
  a . oSP                  V3R  l\        ^4       4       4       V P                  \        \        34      ;_uu_ 4        V P
                  P                  S4       RRR4       . oSP                  V3R l\        ^4       4       4       V P                  \        \        34      ;_uu_ 4        V P
                  P                  S4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)c              3   <   <"   T F  p\        VS4      x  K  	  R # 5ir+   r  r  s   & r   r  ?TestErrorHandling.test_heappop_mutating_heap.<locals>.<genexpr>D  r  r  Nc              3   <   <"   T F  p\        VS4      x  K  	  R # 5ir+   r  r  s   & r   r  r  I  r  r  )r  rB   rI   r   r  rE   rG   rY   r   s   &@r   test_heappop_mutating_heap,TestErrorHandling.test_heappop_mutating_heapB  s    >5:>>
L9::KK% ;>5:>>
L9::KK##D) ;:	 ;: ;::s   C8C1C.	1D	c                   a  ! V3R  lR\         4      p. oV P                  P                  SV! ^ 4      4       V P                  \        V P                  P
                  S^4       R# )c                   .   <a  ] tR tRt o V3R ltRtV tR# )LTestErrorHandling.test_comparison_operator_modifying_heap.<locals>.EvilClassiP  c                0   < SP                  4        \        # r+   clearNotImplemented)r   orL   s   &&r   r  STestErrorHandling.test_comparison_operator_modifying_heap.<locals>.EvilClass.__lt__Q  s    

%%r   r   Nr    r   r!   r"   r  r#   r$   )r&   rL   s   @r   	EvilClassr  P       & &r   r  N)r   rE   rF   rI   r   r   )r   r  rL   s   & @r   'test_comparison_operator_modifying_heap9TestErrorHandling.test_comparison_operator_modifying_heapM  sL    	& 	&
 T9Q<0*dkk&=&=tQGr   c                  aa  ! V3R  lR\         4      p ! V3R lR\         4      p. . uooV P                  P                  SV! ^ 4      4       V P                  P                  SV! ^ 4      4       V P                  \        \
        3V P                  P                  SV! ^4      4       V P                  \        \
        3V P                  P                  SV! ^4      4       . . uooV P                  P                  SV! ^ 4      4       V P                  P                  SV! ^ 4      4       V P                  P                  SV! ^4      4       V P                  P                  SV! ^4      4       V P                  \        \
        3V P                  P                  SV! ^4      4       V P                  \        \
        3V P                  P                  SV! ^4      4       R# )c                   .   <a  ] tR tRt o V3R ltRtV tR# )NTestErrorHandling.test_comparison_operator_modifying_heap_two_heaps.<locals>.hi[  c                0   < SP                  4        \        # r+   r  )r   r  list2s   &&r   r  UTestErrorHandling.test_comparison_operator_modifying_heap_two_heaps.<locals>.h.__lt__\      %%r   r   Nr  )r&   r  s   @r   r   r  [  r  r   r   c                   .   <a  ] tR tRt o V3R ltRtV tR# )NTestErrorHandling.test_comparison_operator_modifying_heap_two_heaps.<locals>.gi`  c                0   < SP                  4        \        # r+   r  )r   r  list1s   &&r   r  UTestErrorHandling.test_comparison_operator_modifying_heap_two_heaps.<locals>.g.__lt__a  r  r   r   Nr  )r&   r  s   @r   r  r  `  r  r   r  N)r   rE   rF   rI   r   r  rX   )r   r   r  r  r  s   &  @@r   1test_comparison_operator_modifying_heap_two_heapsCTestErrorHandling.test_comparison_operator_modifying_heap_two_heapsY  sm   	& 	&
	& 	&
 2uUAaD)UAaD):|4dkk6J6JESTUVSWX:|4dkk6J6JESTUVSWX2u  !-  !-  !-  !-:|4dkk6N6NPUWXYZW[\:|4dkk6N6NPUWXYZW[\r   r   N)r    r   r!   r"   r  r  r  r  r  r  r  r  r  r#   r$   r%   s   @r   r  r    s>     F:<BA	B	*
H] ]r   r  c                       ] tR tRt]tRtR# )TestErrorHandlingPythonix  r   Nr*  r   r   r   r  r  x  r+  r   r  c                       ] tR tRt]tRtR# )TestErrorHandlingCi{  r   Nr.  r   r   r   r  r  {  r/  r   r  __main__)ro   rG   rF   r   r   )&r5  rC   unittestr,   test.supportr   r   r   operatorr   import_fresh_moduler   r   r   r   r;   r=   r)  r-  r1  r7  rB  rD  rM  rb  rj  rp  rv  r~  	itertoolsr   r  r  r  r  r  r    main)funcs   0r   <module>r     s       & ) ,,WxjI

+
+GH:
F N
 
4f}}4 4
R( R"c/ c/LXx  G&'(  ( 
8 8
   	 	    2
( (q] q]h/  G&'*H  ( zMMO ] 5s   E&