+
    Bi#                         ^ RI t ^ RIt^ RIt^ RIHt  ! R R]P
                  4      t]R8X  d   ]P                  ! 4        R# R# )    N)assert_python_okc                      a  ] tR t^t 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V tR# )TestTopologicalSortc                p   R  p\         P                  ! V4      pV P                  \        V! V4      4      \        V4      4       \         P                  ! V4      p\	        VP                  4       4      pV F8  pV Uu0 uF  p\        V4      kK  	  ppV P                  \        V4      V4       K:  	  R# u upi )c              3      "   V P                  4        V P                  4       '       dC   V P                  4       pV F  pV P                  V4       K  	  \	        \        V4      4      x  KX  R # 5iN)prepare	is_active	get_readydonetuplesorted)tsnodesnodes   &  )/usr/lib/python3.14/test/test_graphlib.pystatic_order_with_groupsATestTopologicalSort._test_graph.<locals>.static_order_with_groups	   sM     JJL,,..!DGGDM "F5M**	 !s   &A-AA-N)graphlibTopologicalSorterassertEquallistiterstatic_ordernextset)	selfgraphexpectedr   r   itgroupelementtsgroups	   &&&      r   _test_graphTestTopologicalSort._test_graph   s    	+ ''.6r:;T(^L''. "//#$E/45uGtBxuG5SZ1 5s   <B3c                   \         P                  ! 4       pVP                  4        F  w  rEVP                  ! V.VO5!   K  	   VP	                  4        h   \         P
                   dm   pTP                  w  rxT P                  R P                  \        \        T4      4      R P                  \        \        T^,          4      4      4        Rp?R# Rp?ii ; i) N)r   r   itemsaddr	   
CycleErrorargsassertInjoinmapstr)	r   r   cycler   r   	dependsone_seqs	   &&&      r   _assert_cycle!TestTopologicalSort._assert_cycle   s    '')${{}ODFF4$)$  -	JJL
 	 "" 	RVVFAMM#((3sE?3SXXc#sQw>O5PQQ	Rs   A C*A!CCc                x   V P                  ^^0^	^^0^
^^0^^^0^^^0/. RO4       V P                  ^/ /R.4       T P                  \        ^
4       Uu/ uF  qV^,           0bK  	  up\        ^
RR4       Uu. uF  q3NK  	  up4       V P                  ^^0^^0^^0^^0^^0^^0^^0^^0/. RO4       V P                  ^ ^^.^^.^^^.^^.^^	.^^.^^.^^.^^.^	. /
. RO4       V P                  ^ ^^.^. ^^.^. /. RO4       V P                  ^ ^^.^. ^^.^. ^^.^^.^. /. RO4       R# u upi u upi )	   N))         )      )r8   	   
      ))rA      )r:      )      )r9      )r8   r=   ))r>   )rE   )r9   r<   )rA   r:   r;   )   r8   r   ))rA   r9   rI   rJ   ))rA   r9   rH   )r8   r:   )r   rE   )r$   range)r   xs   & r   test_simple_cases%TestTopologicalSort.test_simple_cases)   s   a"a"r1grAq61q!fE,	

 	!R4&)!&r+AQZ+E"b"<M-N<Mqd<M-N	
 	QQQR"rB4bT2PRtT9	

 	Aq6A3Aq6A3A3A3A3A3A32 >	
  	!aVQAsAr:<PQA2q1#q"a!a!aD'	
5 ,-Ns   D29D7
c           	         V P                  ^^0^^0^^0/RR.4       V P                  ^\        4       ^\        4       ^\        4       /R.4       R# )rA   N)r8   rE   rH   )rA   r9   r:   )r$   r   r   s   &r   test_no_dependencies(TestTopologicalSort.test_no_dependenciesQ   sO    !aS!aS!aS1Iy3IJ!SUAsua7)E    c           	         V P                  ^^0^^0^ . RO/RR.4       \        P                  ! 4       pVP                  ^^4       VP                  ^^4       VP                  ^^4       V P	                  . VP                  4       O^^.4       R# )rA   N)r8   rE   rE   rE   rE   rE   )r8   rE   )r   rA   r9   )r$   r   r   r)   r   r   r   r   s   & r   test_the_node_multiple_times0TestTopologicalSort.test_the_node_multiple_timesV   s    !aS!aS!-?@69BUV '')
q!
q!
q!-2??,-1v6rS   c                    R  \        ^4       4       p\        P                  ! ^ V/4      pV P                  \	        VP                  4       4      . RO4       R# )c              3   B   "   T F  p^V,          ^,           x  K  	  R# 5i)r8   N ).0rL   s   & r   	<genexpr>@TestTopologicalSort.test_graph_with_iterables.<locals>.<genexpr>b   s     11QUQYYs   N)rA   r9   r:   r;   r>   r   )rK   r   r   r   r   r   )r   r1   r   s   &  r   test_graph_with_iterables-TestTopologicalSort.test_graph_with_iterablesa   sA    1a1	''I7boo/02DErS   c                X   \         P                  ! 4       pVP                  ^^4       VP                  ^^4       VP                  ^^4       VP                  ^^4       \         P                  ! ^0 Rm/4      pV P                  . VP	                  4       O. VP	                  4       O4       R# )rA   N>   r8   r9   rE   r:   )r   r   r)   r   r   )r   r   ts2s   &  r   1test_add_dependencies_for_same_node_incrementallyETestTopologicalSort.test_add_dependencies_for_same_node_incrementallyf   s    '')
q!
q!
q!
q!((!\):;-2??,-/D1A1A1C/DErS   c                *    V P                  / . 4       R # r   )r$   rP   s   &r   
test_emptyTestTopologicalSort.test_emptyq   s    R rS   c                v   V P                  ^^0/^^.4       V P                  ^^0^^0/. RO4       V P                  ^^0^^0^^0/. RO4       V P                  ^^0^^0^^0^^0^^0/. RO4       V P                  ^^0^^0^^0^^0^^0^^0/. RO4       V P                  ^^0^^0^^^0^^0/^^.4       R# )rA   N)rA   r8   rA   )rA   r9   r8   rA   )r5   rP   s   &r   
test_cycleTestTopologicalSort.test_cyclet   s    As8aV,AsAs+Y7AsAsAs3\BAsAsAsAsAsC\RAsAsAsAsAsAsKYWAsAsA1vq1#>AGrS   c                   \         P                  ! 4       pV P                  \        R 4      ;_uu_ 4        VP	                  4        RRR4       V P                  \        R 4      ;_uu_ 4        VP                  ^4       RRR4       V P                  \        R 4      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     L; i  + '       g   i     L\; i  + '       g   i     R# ; i)z prepare\(\) must be called firstN)r   r   assertRaisesRegex
ValueErrorr   r   r
   rU   s   & r   test_calls_before_prepare-TestTopologicalSort.test_calls_before_prepare   s    '')##J0STTLLN U##J0STTGGAJ U##J0STTLLN UT	 UTTTTTTs#   B>+C#C$>C	C!	$C5	c                p    \         P                  ! 4       pVP                  4        VP                  4        R # r   )r   r   r	   rU   s   & r   test_prepare_multiple_times/TestTopologicalSort.test_prepare_multiple_times   s"    '')





rS   c                B   \         P                  ! R R/4      pVP                  4        V P                  \	        VP                  4       4      RR04       V P                  \        R4      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; i)abcbcz&cannot prepare\(\) after starting sortN)r   r   r	   r   r   r   rk   rl   rU   s   & r   test_prepare_after_pass_out/TestTopologicalSort.test_prepare_after_pass_out   sk    ''d4


R\\^,sCj9##J0YZZJJL [ZZZs   2BB	c                   \         P                  ! R RRR /4      p\        ^^4       FI  pV P                  \         P                  RV: 2R7      ;_uu_ 4        VP                  4        RRR4       KK  	  R#   + '       g   i     K`  ; i)rs   ru   zattempt=)msgN)r   r   rK   assertRaisesr*   r	   )r   r   attempts   &  r   !test_prepare_cycleerror_each_time5TestTopologicalSort.test_prepare_cycleerror_each_time   si    ''c3(<=Q{G""8#6#6xwjM"JJ

 KJ #JJJs   A66Bc                   \         P                  ! 4       pVP                  ^^^^4       VP                  ^^^4       VP                  4        VP	                  4        V P                  \        R4      ;_uu_ 4        VP                  ^4       RRR4       V P                  \        R4      ;_uu_ 4        VP                  ^4       RRR4       R#   + '       g   i     LJ; i  + '       g   i     R# ; i)rA   znode 2 was not passed outNz#node 24 was not added using add\(\))r   r   r)   r	   r   rk   rl   r   rU   s   & r   test_invalid_nodes_in_done.TestTopologicalSort.test_invalid_nodes_in_done   s    '')
q!Q
q!Q



##J0KLLGGAJ M##J0VWWGGBK XW MLWWWs   ;C3C"C	"C3	c                "   \         P                  ! 4       pVP                  ^^^^4       VP                  ^^4       VP                  4        V P	                  VP                  4       R4       V P	                  VP                  4       R4       VP                  ^4       V P	                  VP                  4       R4       V P	                  VP                  4       R4       VP                  ^4       VP                  ^4       V P	                  VP                  4       R4       V P	                  VP                  4       R4       VP                  ^4       V P	                  VP                  4       R4       V P                  VP                  4       4       R# )rA   N)r9   rE   rZ   rI   r@   )	r   r   r)   r	   r   r   r   assertFalser
   rU   s   & r   	test_doneTestTopologicalSort.test_done   s   '')
q!Q
q!


0,

.,



.,

,(rS   c                n   \         P                  ! 4       pVP                  ^^4       VP                  4        V P	                  VP                  4       4       V P                  VP                  4       R4       V P	                  VP                  4       4       VP                  ^4       V P	                  VP                  4       4       V P                  VP                  4       R4       V P	                  VP                  4       4       VP                  ^4       V P                  VP                  4       4       R# )rA   NrI   r@   )
r   r   r)   r	   
assertTruer
   r   r   r   r   rU   s   & r   test_is_active"TestTopologicalSort.test_is_active   s    '')
q!


'.'

'.'

(rS   c                <   \         P                  ! 4       pV P                  \        VP                  \        4       ^4       V P                  \        VP                  ^\        4       4       V P                  \        VP                  \        4       \        4       4       R# )rA   N)r   r   r{   	TypeErrorr)   dictrU   s   & r   test_not_hashable_nodes+TestTopologicalSort.test_not_hashable_nodes   s`    ''))RVVTVQ7)RVVQ7)RVVTVTV<rS   c                ,   R  p\         P                  ! 4       pVP                  ^^^4       VP                  ^^ 4       VP                  ^^4       VP                  ^^4       VP                  ^^4       \         P                  ! 4       pVP                  ^^ 4       VP                  ^^^4       VP                  ^^4       VP                  ^^4       VP                  ^^4       V P                  \	        V! V4      4      \	        V! V4      4      4       R# )c              3      "   V P                  4        V P                  4       '       d0   V P                  4       pV P                  ! V!   \	        V4      x  KE  R # 5ir   )r	   r
   r   r   r   )r   r   s   & r   
get_groups^TestTopologicalSort.test_order_of_insertion_does_not_matter_between_groups.<locals>.get_groups   s>     JJL,,..%j  !s
   &A1AN)r   r   r)   r   r   )r   r   r   ra   s   &   r   6test_order_of_insertion_does_not_matter_between_groupsJTestTopologicalSort.test_order_of_insertion_does_not_matter_between_groups   s    	! '')
q!Q
q!
q!
q!
q!((*11a111jn-tJsO/DErS   c                    R  pV! R4      pV! R4      pV P                  VR4       V P                  VR4       V P                  W#4       R# )c                     R p\         P                  P                  4       pRVR&   \        V 4      VR&   \	        RV3/ VB pV# )ax  if 1:
                import graphlib
                ts = graphlib.TopologicalSorter()
                ts.add('blech', 'bluch', 'hola')
                ts.add('abcd', 'blech', 'bluch', 'a', 'b')
                ts.add('a', 'a string', 'something', 'b')
                ts.add('bluch', 'hola', 'abcde', 'a', 'b')
                print(list(ts.static_order()))
                T
__cleanenvPYTHONHASHSEEDz-c)osenvironcopyr/   r   )seedcodeenvouts   &   r   check_order_with_hash_seedlTestTopologicalSort.test_static_order_does_not_change_with_the_hash_seed.<locals>.check_order_with_hash_seed   sL    D **//#C !%C$'IC !"455CJrS   i  iz   N)assertNotEqualr   )r   r   run1run2s   &   r   4test_static_order_does_not_change_with_the_hash_seedHTestTopologicalSort.test_static_order_does_not_change_with_the_hash_seed   sK    	$ *$/)%0D"%D"%$rS   rZ   N)__name__
__module____qualname____firstlineno__r$   r5   rM   rQ   rV   r^   rb   re   rh   rm   rp   rw   r}   r   r   r   r   r   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      so     2*
&
PF
	7F
	F!H

),)=F0% %rS   r   __main__)	r   r   unittesttest.support.script_helperr   TestCaser   r   mainrZ   rS   r   <module>r      s>     	  7~%(++ ~%@ zMMO rS   