a
    h(                     @   s>   d dl Z d dlZd dlmZmZ d dlmZ G dd dZdS )    N)read_p2g	write_p2g)edges_equalc                   @   s0   e Zd Zedd Zdd Zdd Zdd Zd	S )
TestP2Gc                 C   s@   t jdd| _g d}| j| | jd t | j| _d S )Ntest)name)abr
   c)r   d)r   e)r   f)r	   r   g)nxZGraphGadd_edges_fromadd_nodeDiGraphZDG)clsr    r   O/var/www/auris/lib/python3.9/site-packages/networkx/readwrite/tests/test_p2g.pysetup_class	   s
    zTestP2G.setup_classc                 C   sd   d}t |}t|}|jdks$J t|g dks8J dd | D }t| g ds`J d S )Ns   name
3 4
a
1 2
b

c
0 2
r   )r	   r
   r   c                 S   s    g | ]\}}t |t |fqS r   )str).0uvr   r   r   
<listcomp>        z)TestP2G.test_read_p2g.<locals>.<listcomp>))r	   r   r   )r   r	   )r   r   )ioBytesIOr   r   sortededgesr   )selfsZbytesIOr   r#   r   r   r   test_read_p2g   s    

zTestP2G.test_read_p2gc                 C   sT   d}t  }t }d|_|ddg t|| |d | }||ksPJ d S )Ns   foo
3 2
1
1 
2
2 
3

foo)      )r)      r   )	r    r!   r   r   r   r   r   seekread)r$   r%   fhr   rr   r   r   test_write_p2g#   s    	

zTestP2G.test_write_p2gc                 C   sZ   t  }t }d|_|ddg t|| |d t|}t	|
 |
 sVJ d S )Nr'   r   r   r   )r    r!   r   r   r   r   r   r+   r   r   r#   )r$   r-   r   Hr   r   r   test_write_read_p2g6   s    

zTestP2G.test_write_read_p2gN)__name__
__module____qualname__classmethodr   r&   r/   r1   r   r   r   r   r      s
   
r   )	r    Znetworkxr   Znetworkx.readwrite.p2gr   r   Znetworkx.utilsr   r   r   r   r   r   <module>   s   