o
    3ήc                     @   s.   d dl Z d dlZd dlmZ G dd dZdS )    N)NetworkXNotImplementedc                   @   s8   e Zd Zedd Zdd Zdd Zdd Zd	d
 ZdS )TestAttractingComponentsc                 C   s\   t  | _| jg d t  | _| jg d t  | _| jg d t  | _d S )N)	)      )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   )nxDiGraphG1add_edges_fromG2G3G4)cls r   [/tmp/pip-target-vg8gfxp4/lib/python/networkx/algorithms/components/tests/test_attracting.pysetup_class   s   


z$TestAttractingComponents.setup_classc                 C   s   t t| j}dh|v sJ dh|v sJ dh|v sJ t t| j}dd |D }|dgks3J t t| j}dd |D }d|v sHJ d|v sNJ t|dksVJ t t| j}|g ksdJ d S )	Nr   r   r   c                 S      g | ]}t t|qS r   tuplesorted.0xr   r   r   
<listcomp>'       zGTestAttractingComponents.test_attracting_components.<locals>.<listcomp>r   c                 S   r   r   r   r!   r   r   r   r$   +   r%   r   )listr   attracting_componentsr   r   r   lenr   )selfacr   r   r   test_attracting_components    s   z3TestAttractingComponents.test_attracting_componentsc                 C   sT   t | jdks
J t | jdksJ t | jdksJ t | jdks(J d S )Nr   r   r   r   )r   number_attracting_componentsr   r   r   r   )r)   r   r   r    test_number_attacting_components3   s   z9TestAttractingComponents.test_number_attacting_componentsc                 C   sb   t | jrJ t | jrJ t | jrJ | jddg}t |s'J t | jr/J d S )Nr   r   )r   is_attracting_componentr   r   r   subgraphr   )r)   g2r   r   r   test_is_attracting_component9   s   z5TestAttractingComponents.test_is_attracting_componentc                 C   sd   t  }tt tt | W d    n1 sw   Y  ttt j| ttt j| d S )N)	r   Graphpytestraisesr   nextr'   r,   r.   )r)   Gr   r   r   test_connected_raiseA   s   z-TestAttractingComponents.test_connected_raiseN)	__name__
__module____qualname__classmethodr   r+   r-   r1   r7   r   r   r   r   r      s    
r   )r3   networkxr   r   r   r   r   r   r   <module>   s    