o
    ˷e/                     @   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)nxGraphGadd_edges_fromadd_nodeDiGraphDG)clsr    r   X/var/www/ideatree/venv/lib/python3.10/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sJ dd | D }t| g ds0J 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>    s     z)TestP2G.test_read_p2g.<locals>.<listcomp>))r	   r   r   )r   r	   )r   r   )ioBytesIOr   r   sortededgesr   )selfs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s(J d S )Ns   foo
3 2
1
1 
2
2 
3

foo)      )r+      r   )	r!   r"   r   OrderedDiGraphr   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	|
 |
 s+J d S )Nr)   r   r   r   )r!   r"   r   r   r   r   r   r.   r   r   r$   )r%   r0   r   Hr   r   r   test_write_read_p2g6   s   

zTestP2G.test_write_read_p2gN)__name__
__module____qualname__classmethodr   r(   r2   r4   r   r   r   r   r      s    
r   )	r!   networkxr   networkx.readwrite.p2gr   r   networkx.utilsr   r   r   r   r   r   <module>   s
    