HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/samba/tests/kcc/__pycache__/graph_utils.cpython-310.pyc
o

�/a��@shdZddlZddlZddlmZddlmZmZmZmZm	Z	m
Z
ddlZdd�ZGdd�dej
j�ZdS)	zTests for samba.kcc.graph_utils�N)�
GraphError)�verify_graph_complete�verify_graph_connected�*verify_graph_connected_under_edge_failures�verify_graph_forest�,verify_graph_connected_under_vertex_failures�verify_graph_no_lonely_verticescCs�t|�dkrdSt|�}t�}t�}|�|���|�|���|�t|��|rA|��}|��}||f}|�|�|�|�|s)t|�S)N��)�len�set�add�pop�tuple�update)�vertices�	remaining�used�edges�v�w�er
r
�=/usr/lib/python3/dist-packages/samba/tests/kcc/graph_utils.py�	make_tree#s 

�rcsdeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Z�Z
S)�UndirectedGraphTestsc	stt|���td�}td�}tt�|d��}tt�|d��}tt|dd�|dd���}||d|dfg}t|�}t|�}|||g|_	||||||g|_
||||g|_|||g|_|||g|_
|||g|_||||||g|_d|df|_dS)N�abcdefgh�ijkr	����rr
)�superr�setUpr�	itertools�combinations�list�zipr�complete_graph�disconnected_clusters�graph_with_unreachables�ring�line�tree�forest�unconnected_graph)	�selfr�	vertices2r�edges2�
line_edges�
ring_edgesr*�tree2��	__class__r
rr 9s4���zUndirectedGraphTests.setUpcGs|jt|g|�R�S�N)�assertRaisesr)r-�fn�argsr
r
r�assertGraphErrorYsz%UndirectedGraphTests.assertGraphErrorcCsht}|j|g|j�R�|j|g|j�R�|j|g|j�R�|j|g|j�R�|�||j��dSr5)rr9r&r'r(r*�assertIsNoner%�r-r7r
r
r�test_graph_complete\sz(UndirectedGraphTests.test_graph_completecCs�t}|j|g|j�R�|j|g|j�R�|j|g|j�R�|j|g|j�R�|�||j��|�||j��|�||j	��|�||j
��dSr5)rr9r&r'r+r,r:r)r(r%r*r;r
r
r�test_graph_connectedfsz)UndirectedGraphTests.test_graph_connectedcCs�t}|j|g|j�R�|j|g|j�R�|j|g|j�R�|�||j��|�||j��|�||j��|�||j	��dSr5)
rr9r&r'r(r:r)r*r+r,r;r
r
r�test_graph_forestssz&UndirectedGraphTests.test_graph_forestcC�xt}|j|g|j�R�|j|g|j�R�|j|g|j�R�|j|g|j�R�|�||j��|�||j��dSr5)	rr9r)r*r+r&r:r(r%r;r
r
r�(test_graph_connected_under_edge_failuressz=UndirectedGraphTests.test_graph_connected_under_edge_failurescCr?r5)	rr9r)r*r+r&r:r(r%r;r
r
r�*test_graph_connected_under_vertex_failures�sz?UndirectedGraphTests.test_graph_connected_under_vertex_failurescC�dSr5r
�r-r
r
r�test_graph_multi_edge_forest��z1UndirectedGraphTests.test_graph_multi_edge_forestcCs�t}|j|g|j�R�|j|g|j�R�|�||j��|�||j��|�||j��|�||j��|�||j	��dSr5)
rr9r,r'r:r(r%r)r*r+r;r
r
r�test_graph_no_lonely_vertices�sz2UndirectedGraphTests.test_graph_no_lonely_verticescCrBr5r
rCr
r
r�test_graph_no_unknown_vertices�rEz3UndirectedGraphTests.test_graph_no_unknown_vertices)�__name__�
__module__�__qualname__r r9r<r=r>r@rArDrFrG�
__classcell__r
r
r3rr7s 

r)�__doc__�samba�samba.tests�samba.kcc.graph_utilsrrrrrrrr!r�tests�TestCaserr
r
r
r�<module>s