Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_graphlib.cpython-39.opt-2.pyc

a

��g_!�@sVddlmZddlZddlZddlZddlmZGdd�dej�Ze	dkrRe�
�dS)�)�chainN)�assert_python_okc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#S)$�TestTopologicalSortcspdd�}t�|�}|�t||��t|��t�|�}t|����|D]&}�fdd�|D�}|�t|�|�qDdS)Ncss@|��|��r<|��}|D]}|�|�qtt|��VqdS�N)�prepare�	is_active�	get_ready�done�tuple�sorted)�ts�nodes�node�r�./usr/local/lib/python3.9/test/test_graphlib.py�static_order_with_groups
szATestTopologicalSort._test_graph.<locals>.static_order_with_groupscsh|]}t���qSr)�next)�.0�element��itrr�	<setcomp>�z2TestTopologicalSort._test_graph.<locals>.<setcomp>)�graphlib�TopologicalSorter�assertEqual�list�iter�static_order�set)�self�graphZexpectedrr�groupZtsgrouprrr�_test_graph	s

zTestTopologicalSort._test_graphc	Cs�t��}|��D]\}}|j|g|�R�qz|��WnXtjy�}z>|j\}}|�d�t	t
|��d�t	t
|d���WYd}~nd}~00�dS)N� �)rr�items�addrZ
CycleError�argsZassertIn�join�map�str)	r r!�cyclerr�	dependson�e�msg�seqrrr�
_assert_cycles
>z!TestTopologicalSort._assert_cyclec
Cs(|�dhddhddhddhddhd�gd��|�diid	g�|�d
d�td�D�d
d�tddd�D��|�dhdhdhdhdhdhdhdhd�gd��|�ddgdgddgdgdgdgdgdgdggd�
gd��|�ddggdggd�gd��|�ddggdggdgdggd�gd��dS) N�����)r%�	�
r2r3))r4r6r5)r3r2)r%r7r8��r9cSsi|]}||dh�qSr:r�r�xrrr�
<dictcomp>3rz9TestTopologicalSort.test_simple_cases.<locals>.<dictcomp>r8cSsg|]
}|f�qSrrr;rrr�
<listcomp>3rz9TestTopologicalSort.test_simple_cases.<locals>.<listcomp>������
��)r%r4r@r6r2rArBrC))r9rD)r6rC)r@rB)r4rA)r%r2r%�r7)
rr9r%r4r@r6rEr5r3r7))r7)r@)r4r3)r9r6r5)rE�r%�r)rr9r%r4))r9r4rFrG)rr9r%r4r@r6rE))r9r4rE)r%r6)rr@)r#�range�r rrr�test_simple_cases*s> �$�$��� �z%TestTopologicalSort.test_simple_casescCs>|�dhdhdhd�ddg�|�t�t�t�d�dg�dS)Nr%r@rE)r9r4r6)r%r@rE)r#rrIrrr�test_no_dependenciesRsz(TestTopologicalSort.test_no_dependenciescCsh|�dhdhgd�d�ddg�t��}|�dd�|�dd�|�dd�|�g|���ddg�dS)Nr%r@)r%r@r@r@r@r@)r9r4r)r%r@)rr9r4r9)r#rrr'rr�r rrrr�test_the_node_multiple_timesWs z0TestTopologicalSort.test_the_node_multiple_timescCs<dd�td�D�}t�d|i�}|�t|���gd��dS)Ncss|]}d|dVqdS)r%r9Nrr;rrr�	<genexpr>crz@TestTopologicalSort.test_graph_with_iterables.<locals>.<genexpr>r6r)r9r4r6r5r7r)rHrrrrr)r r-rrrr�test_graph_with_iterablesbsz-TestTopologicalSort.test_graph_with_iterablescCsjt��}|�dd�|�dd�|�dd�|�dd�t�dhd�i�}|�g|���g|����dS)Nr9r%r4r@r6>r%r4r@r6)rrr'rr)r r�ts2rrr�1test_add_dependencies_for_same_node_incrementallygszETestTopologicalSort.test_add_dependencies_for_same_node_incrementallycCs|�ig�dSr)r#rIrrr�
test_emptyrszTestTopologicalSort.test_emptyc	Cs�|�ddhiddg�|�dhdhd�gd��|�dhdhdhd�gd��|�dhdhdhdhd	hd
�gd��|�dhdhdhdhdhd	hd
�gd��|�dhdhddhdhd�ddg�dS)Nr9r%)r9r%)r9r%r9r4)r9r%r4)r9r4r%r9r@rE)r9r%r4r6r@r6r5)r9r%r4r@rEr5)r9r%r4r@)r1rIrrr�
test_cycleus&*zTestTopologicalSort.test_cyclecCs�t��}|�td��|��Wd�n1s20Y|�td��|�d�Wd�n1sh0Y|�td��|��Wd�n1s�0YdS)Nz prepare\(\) must be called firstr4)rr�assertRaisesRegex�
ValueErrorrr	rrLrrr�test_calls_before_prepare�s&(z-TestTopologicalSort.test_calls_before_preparecCsHt��}|��|�td��|��Wd�n1s:0YdS)Nz!cannot prepare\(\) more than once)rrrrTrUrLrrr�test_prepare_multiple_times�sz/TestTopologicalSort.test_prepare_multiple_timescCs�t��}|�dddd�|�ddd�|��|��|�td��|�d�Wd�n1sb0Y|�td��|�d�Wd�n1s�0YdS)Nr9r%r4r@znode 2 was not passed outz#node 24 was not added using add\(\)�)rrr'rrrTrUr	rLrrr�test_invalid_nodes_in_done�s(z.TestTopologicalSort.test_invalid_nodes_in_donecCs�t��}|�dddd�|�dd�|��|�|��d�|�|��d�|�d�|�|��d�|�|��d�|�d�|�d�|�|��d�|�|��d�|�d�|�|��d�|�|���dS)	Nr9r%r4r@)r4r@rrFr:)	rrr'rrrr	�assertFalserrLrrr�	test_done�s 



zTestTopologicalSort.test_donecCs�t��}|�dd�|��|�|���|�|��d�|�|���|�d�|�|���|�|��d�|�|���|�d�|�	|���dS)Nr9r%rFr:)
rrr'rZ
assertTruerrrr	rZrLrrr�test_is_active�s

z"TestTopologicalSort.test_is_activecCsJt��}|�t|jt�d�|�t|jdt��|�t|jt�t��dS)Nr9)rrZassertRaises�	TypeErrorr'�dictrLrrr�test_not_hashable_nodes�sz+TestTopologicalSort.test_not_hashable_nodescCs�dd�}t��}|�ddd�|�dd�|�dd�|�d	d
�|�dd
�t��}|�dd�|�ddd�|�dd
�|�d	d
�|�dd�|�t||��t||���dS)Ncss2|��|��r.|��}|j|�t|�VqdSr)rrrr	r)rr
rrr�
get_groups�s

z^TestTopologicalSort.test_order_of_insertion_does_not_matter_between_groups.<locals>.get_groupsr4r%r9rr@r6rEr5)rrr'rr)r r`rrPrrr�6test_order_of_insertion_does_not_matter_between_groups�szJTestTopologicalSort.test_order_of_insertion_does_not_matter_between_groupscCs@dd�}|d�}|d�}|�|d�|�|d�|�||�dS)NcSs8d}tj��}d|d<t|�|d<td|fi|��}|S)Naxif 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()))
                TZ
__cleanenvZPYTHONHASHSEEDz-c)�os�environ�copyr+r)�seed�code�env�outrrr�check_order_with_hash_seed�s	
zlTestTopologicalSort.test_static_order_does_not_change_with_the_hash_seed.<locals>.check_order_with_hash_seedi�i�z�)ZassertNotEqualr)r riZrun1Zrun2rrr�4test_static_order_does_not_change_with_the_hash_seed�szHTestTopologicalSort.test_static_order_does_not_change_with_the_hash_seedN)�__name__�
__module__�__qualname__r#r1rJrKrMrOrQrRrSrVrWrYr[r\r_rarkrrrrrs"(
r�__main__)�	itertoolsrrrbZunittestZtest.support.script_helperrZTestCaserrl�mainrrrr�<module>su

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists