o
    3ήc                     @   s:   d dl Z d dlZd dlZd dlmZmZ G dd dZdS )    N)adjacency_dataadjacency_graphc                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )TestAdjacencyc                 C   s*   t d}tt|}t ||sJ d S )N   )nx
path_graphr   r   is_isomorphicselfGH r   Y/tmp/pip-target-vg8gfxp4/lib/python/networkx/readwrite/json_graph/tests/test_adjacency.py
test_graph
   s   
zTestAdjacency.test_graphc                 C   s   t d}|jddd |jdddd d|jd	< d
|jd< tt|}|jd	 dks-J |jd d dks8J |d d d dksDJ t	t|}tt
|}|jd	 dks[J |jd d
ksdJ |jd d dksoJ |d d d dks{J d S )Nr      red)color      )widthbarfoooner   r   )r   r   add_nodeadd_edgegraphr   r   nodesjsondumpsloads)r
   r   r   dr   r   r   test_graph_attributes   s   


z#TestAdjacency.test_graph_attributesc                 C   sD   t  }t |g d tt|}| sJ t ||s J d S N)r   r      )r   DiGraphadd_pathr   r   is_directedr   r	   r   r   r   test_digraph"   s
   zTestAdjacency.test_digraphc                 C   s@   t  }t |g d tt|}| sJ | sJ d S r"   )r   MultiDiGraphr%   r   r   r&   is_multigraphr	   r   r   r   test_multidigraph)   s
   zTestAdjacency.test_multidigraphc                 C   sf   t  }|jdddd |jddddd tt|}t ||s#J |d d d d dks1J d S )	Nr   r   first)keysecondblue)r,   r   r   )r   
MultiGraphr   r   r   r   r	   r   r   r   test_multigraph0   s    zTestAdjacency.test_multigraphc                 C   sP   t tj t }tddd}t|| W d    d S 1 s!w   Y  d S )Nnode)idr,   )pytestraisesr   NetworkXErrorr(   dictr   )r
   r   attrsr   r   r   test_exception8   s
   "zTestAdjacency.test_exceptionN)	__name__
__module____qualname__r   r!   r'   r*   r0   r8   r   r   r   r   r   	   s    r   )r   r3   networkxr   networkx.readwrite.json_graphr   r   r   r   r   r   r   <module>   s
    