U
    ¹mœd¨ ã                   @   sž   d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	m
Z
 G dd„ dƒZG dd„ deƒZG dd	„ d	eƒZG d
d„ deƒZdd„ Zdd„ Zdd„ ZdS )é    N)ÚGraphMLWriter)Úedges_equalÚnodes_equalc                   @   s   e Zd Zedd„ ƒZdS )ÚBaseGraphMLc                 C   sD  d| _ t ¡ | _| j d¡ | jjdddd� | j dd¡ | j ddd	d
ddddddg
¡ t | j  	d¡¡| _
d| _tjdd�| _ddi| jjd< | jjddd� | jjddd� | jjddd� | j d¡ | jjddd� | jjdddd d!� | jjdd"d#d d!� | jjd"dd$d%d!� | jjddd&d� | jjddd'd� | jjddd(d� | jjddd)d*d!� t | j 	d¡¡| _d+| _tjdd�| _d,d-d-d.d.d/d0œ| jjd< | j d¡ | j d"¡ | jjdd"dd� t | j 	d¡¡| _d1| _t ¡ | _| jjd2d3d4d5� | jjd6d7d4d5� | jjd2d6d8d9� t | j 	d¡¡}|| _d:| _t ¡ | _| jjdd;d<� | jjd"d%d<� | jjdd"d;d<� | jjd"d"d d<� t | j 	d¡¡}|| _d=| _t ¡ | _| j d¡ | jjdddd� | j ddg¡ t | j 	d¡¡}|| _d>| _t ¡ | _| j d¡ | jjdddd� | jjd"dd#d� | jjdd"d$d� t | j 	d¡¡}|| _d?| _ t ¡ | _!| j! d¡ | j!jdddd� | j!jd"dd#d� | j!jddd$d� t | j  	d¡¡}|| _"d@| _#t ¡ | _$| j$ d¡ | j$ dd¡ | j$jd"dd#d� | j$jdd"d$d� t | j# 	d¡¡}|| _%d S )ANa  <?xml version="1.0" encoding="UTF-8"?>
<!-- This file was written by the JAVA GraphML Library.-->
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G" edgedefault="directed">
    <node id="n0"/>
    <node id="n1"/>
    <node id="n2"/>
    <node id="n3"/>
    <node id="n4"/>
    <node id="n5"/>
    <node id="n6"/>
    <node id="n7"/>
    <node id="n8"/>
    <node id="n9"/>
    <node id="n10"/>
    <edge id="foo" source="n0" target="n2"/>
    <edge source="n1" target="n2"/>
    <edge source="n2" target="n3"/>
    <edge source="n3" target="n5"/>
    <edge source="n3" target="n4"/>
    <edge source="n4" target="n6"/>
    <edge source="n6" target="n5"/>
    <edge source="n5" target="n7"/>
    <edge source="n6" target="n8"/>
    <edge source="n8" target="n7"/>
    <edge source="n8" target="n9"/>
  </graph>
</graphml>Zn10Ún0Ún2Úfoo©Úid)Ún1r   )r   Ún3)r   Ún5)r   Ún4)r   Ún6)r   r   )r   Ún7)r   Ún8)r   r   )r   Zn9úUTF-8a  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
        http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="d0" for="node" attr.name="color" attr.type="string">
    <default>yellow</default>
  </key>
  <key id="d1" for="edge" attr.name="weight" attr.type="double"/>
  <graph id="G" edgedefault="directed">
    <node id="n0">
      <data key="d0">green</data>
    </node>
    <node id="n1"/>
    <node id="n2">
      <data key="d0">blue</data>
    </node>
    <node id="n3">
      <data key="d0">red</data>
    </node>
    <node id="n4"/>
    <node id="n5">
      <data key="d0">turquoise</data>
    </node>
    <edge id="e0" source="n0" target="n2">
      <data key="d1">1.0</data>
    </edge>
    <edge id="e1" source="n0" target="n1">
      <data key="d1">1.0</data>
    </edge>
    <edge id="e2" source="n1" target="n3">
      <data key="d1">2.0</data>
    </edge>
    <edge id="e3" source="n3" target="n2"/>
    <edge id="e4" source="n2" target="n4"/>
    <edge id="e5" source="n3" target="n5"/>
    <edge id="e6" source="n5" target="n4">
      <data key="d1">1.1</data>
    </edge>
  </graph>
</graphml>
ÚGÚcolorÚyellowÚnode_defaultÚgreen)r   Úbluer   Úredr   r   Z	turquoiseÚe0g      ð?)r
   Úweightr   Úe1Úe2g       @Ze3Ze4Ze5Ze6çš™™™™™ñ?a’  <?xml version="1.0" encoding="UTF-8"?>
        <graphml xmlns="http://graphml.graphdrawing.org/xmlns"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
                http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
          <key id="d0" for="node" attr.name="boolean_attribute" attr.type="boolean"><default>false</default></key>
          <key id="d1" for="node" attr.name="int_attribute" attr.type="int"><default>0</default></key>
          <key id="d2" for="node" attr.name="long_attribute" attr.type="long"><default>0</default></key>
          <key id="d3" for="node" attr.name="float_attribute" attr.type="float"><default>0.0</default></key>
          <key id="d4" for="node" attr.name="double_attribute" attr.type="double"><default>0.0</default></key>
          <key id="d5" for="node" attr.name="string_attribute" attr.type="string"><default>Foo</default></key>
          <graph id="G" edgedefault="directed">
            <node id="n0"/>
            <node id="n1"/>
            <edge id="e0" source="n0" target="n1"/>
          </graph>
        </graphml>
        Fr   g        ZFoo)Zboolean_attributeZint_attributeZlong_attributeZfloat_attributeZdouble_attributeZstring_attributeaV  <?xml version='1.0' encoding='utf-8'?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="edge_prop" for="edge" attr.name="edge_prop" attr.type="string"/>
  <key id="prop2" for="node" attr.name="prop2" attr.type="string"/>
  <key id="prop1" for="node" attr.name="prop1" attr.type="string"/>
  <graph edgedefault="directed">
    <node id="0">
      <data key="prop1">val1</data>
      <data key="prop2">val2</data>
    </node>
    <node id="1">
      <data key="prop1">val_one</data>
      <data key="prop2">val2</data>
    </node>
    <edge source="0" target="1">
      <data key="edge_prop">edge_value</data>
    </edge>
  </graph>
</graphml>
Ú0Zval1Zval2)Úprop1Úprop2Ú1Zval_oneZ
edge_value)Ú	edge_propaC  <?xml version='1.0' encoding='utf-8'?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key attr.name="weight" attr.type="double" for="node" id="d1" />
  <key attr.name="weight" attr.type="double" for="edge" id="d0" />
  <graph edgedefault="directed">
    <node id="n0">
      <data key="d1">1</data>
    </node>
    <node id="n1">
      <data key="d1">2.0</data>
    </node>
    <edge source="n0" target="n1">
      <data key="d0">1</data>
    </edge>
    <edge source="n1" target="n0">
      <data key="d0">k</data>
    </edge>
    <edge source="n1" target="n1">
      <data key="d0">1.0</data>
    </edge>
  </graph>
</graphml>
é   ©r   a  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G">
    <node id="n0"/>
    <node id="n1"/>
    <node id="n2"/>
    <node id="n10"/>
    <edge id="foo" source="n0" target="n2"/>
    <edge source="n1" target="n2"/>
    <edge source="n2" target="n3"/>
  </graph>
</graphml>a  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G">
    <node id="n0"/>
    <node id="n1"/>
    <node id="n2"/>
    <node id="n10"/>
    <edge id="e0" source="n0" target="n2"/>
    <edge id="e1" source="n1" target="n2"/>
    <edge id="e2" source="n2" target="n1"/>
  </graph>
</graphml>a  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G">
    <node id="n0"/>
    <node id="n1"/>
    <node id="n2"/>
    <node id="n10"/>
    <edge id="e0" source="n0" target="n2"/>
    <edge id="e1" source="n1" target="n2"/>
    <edge id="e2" source="n2" target="n3"/>
  </graph>
</graphml>a  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G">
    <node id="n0"/>
    <node id="n1"/>
    <node id="n2"/>
    <node id="n10"/>
    <edge source="n0" target="n2"/>
    <edge id="e1" source="n1" target="n2"/>
    <edge id="e2" source="n2" target="n1"/>
  </graph>
</graphml>)&Úsimple_directed_dataÚnxZDiGraphÚsimple_directed_graphÚadd_nodeÚadd_edgeÚadd_edges_fromÚioÚBytesIOÚencodeÚsimple_directed_fhÚattribute_dataÚattribute_graphÚgraphÚattribute_fhZnode_attribute_default_dataÚnode_attribute_default_graphÚnode_attribute_default_fhZattribute_named_key_ids_dataÚattribute_named_key_ids_graphÚattribute_named_key_ids_fhZattribute_numeric_type_dataÚattribute_numeric_type_graphÚattribute_numeric_type_fhÚsimple_undirected_dataÚGraphÚsimple_undirected_graphÚsimple_undirected_fhÚundirected_multigraph_dataÚ
MultiGraphÚundirected_multigraphÚundirected_multigraph_fhÚ'undirected_multigraph_no_multiedge_dataÚ"undirected_multigraph_no_multiedgeÚ%undirected_multigraph_no_multiedge_fhÚ'multigraph_only_ids_for_multiedges_dataÚ"multigraph_only_ids_for_multiedgesÚ%multigraph_only_ids_for_multiedges_fh)ÚclsÚfh© rJ   ú^/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/networkx/readwrite/tests/test_graphml.pyÚsetup_class   sÀ    
öÿ*ú
ÿ





zBaseGraphML.setup_classN)Ú__name__Ú
__module__Ú__qualname__ÚclassmethodrL   rJ   rJ   rJ   rK   r      s   r   c                   @   sœ   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%S )&ÚTestReadGraphMLc                 C   sæ   | j }t | j¡}t| ¡ ƒt| ¡ ƒks.t‚t| ¡ ƒt| ¡ ƒksJt‚t|jdd�ƒt|jdd�ƒksnt‚| j d¡ t 	| j
¡}t| ¡ ƒt| ¡ ƒks¢t‚t| ¡ ƒt| ¡ ƒks¾t‚t|jdd�ƒt|jdd�ƒksât‚d S ©NT©Údatar   )r(   r'   Úread_graphmlr/   ÚsortedÚnodesÚAssertionErrorÚedgesÚseekÚparse_graphmlr&   ©Úselfr   ÚHÚPGrJ   rJ   rK   Ú!test_read_simple_directed_graphml<  s    $z1TestReadGraphML.test_read_simple_directed_graphmlc                 C   s†   | j }t | j¡}t| ¡ | ¡ ƒs(t‚t| ¡ | ¡ ƒs>t‚| j 	d¡ t 
| j¡}t| ¡ | ¡ ƒslt‚t| ¡ | ¡ ƒs‚t‚d S ©Nr   )r<   r'   rU   r=   r   rW   rX   r   rY   rZ   r[   r:   r\   rJ   rJ   rK   Ú#test_read_simple_undirected_graphmlI  s    z3TestReadGraphML.test_read_simple_undirected_graphmlc                 C   s†   | j }t | j¡}t| ¡ | ¡ ƒs(t‚t| ¡ | ¡ ƒs>t‚| j 	d¡ t 
| j¡}t| ¡ | ¡ ƒslt‚t| ¡ | ¡ ƒs‚t‚d S ra   )r@   r'   rU   rA   r   rW   rX   r   rY   rZ   r[   r>   r\   rJ   rJ   rK   Ú'test_read_undirected_multigraph_graphmlT  s    z7TestReadGraphML.test_read_undirected_multigraph_graphmlc                 C   s†   | j }t | j¡}t| ¡ | ¡ ƒs(t‚t| ¡ | ¡ ƒs>t‚| j 	d¡ t 
| j¡}t| ¡ | ¡ ƒslt‚t| ¡ | ¡ ƒs‚t‚d S ra   )rC   r'   rU   rD   r   rW   rX   r   rY   rZ   r[   rB   r\   rJ   rJ   rK   Ú4test_read_undirected_multigraph_no_multiedge_graphml_  s    zDTestReadGraphML.test_read_undirected_multigraph_no_multiedge_graphmlc                 C   s†   | j }t | j¡}t| ¡ | ¡ ƒs(t‚t| ¡ | ¡ ƒs>t‚| j 	d¡ t 
| j¡}t| ¡ | ¡ ƒslt‚t| ¡ | ¡ ƒs‚t‚d S ra   )rF   r'   rU   rG   r   rW   rX   r   rY   rZ   r[   rE   r\   rJ   rJ   rK   Ú?test_read_undirected_multigraph_only_ids_for_multiedges_graphmlj  s    zOTestReadGraphML.test_read_undirected_multigraph_only_ids_for_multiedges_graphmlc                 C   sð   | j }t | j¡}t| d¡t|jdd�ƒƒs2t‚t|jdd�ƒ}t|jdd�ƒ}t	||ƒD ]\}}||ks\t‚q\| j 
d¡ t | j¡}t| d¡ƒt|jdd�ƒks¬t‚t|jdd�ƒ}t|jdd�ƒ}t	||ƒD ]\}}||ksÖt‚qÖd S rR   )r1   r'   rU   r3   r   rW   rV   rX   rY   ÚziprZ   r[   r0   )r]   r   r^   ÚgeÚheÚaÚbr_   rJ   rJ   rK   Útest_read_attribute_graphmlu  s     "z+TestReadGraphML.test_read_attribute_graphmlc                 C   s.   | j }t | j¡}|jd |jd ks*t‚d S )Nr   )r4   r'   rU   r5   r2   rX   )r]   r   r^   rJ   rJ   rK   Ú#test_node_default_attribute_graphml†  s    z3TestReadGraphML.test_node_default_attribute_graphmlc                 C   s<   d}t  | d¡¡}t tjtj|¡ t tjtj|¡ d S )NaÛ  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G">
    <node id="n0"/>
    <node id="n1"/>
    <node id="n2"/>
    <edge source="n0" target="n1"/>
    <edge source="n1" target="n2" directed='true'/>
  </graph>
</graphml>r   ©	r,   r-   r.   ÚpytestÚraisesr'   ÚNetworkXErrorrU   r[   ©r]   ÚsrI   rJ   rJ   rK   Ú test_directed_edge_in_undirected‹  s    z0TestReadGraphML.test_directed_edge_in_undirectedc                 C   s<   d}t  | d¡¡}t tjtj|¡ t tjtj|¡ d S )Naó  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G" edgedefault='directed'>
    <node id="n0"/>
    <node id="n1"/>
    <node id="n2"/>
    <edge source="n0" target="n1"/>
    <edge source="n1" target="n2" directed='false'/>
  </graph>
</graphml>r   rm   rq   rJ   rJ   rK   Ú test_undirected_edge_in_directed�  s    z0TestReadGraphML.test_undirected_edge_in_directedc                 C   s<   d}t  | d¡¡}t tjtj|¡ t tjtj|¡ d S )Naô  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="d0" for="node" attr.name="color" attr.type="string">
    <default>yellow</default>
  </key>
  <key id="d1" for="edge" attr.name="weight" attr.type="double"/>
  <graph id="G" edgedefault="directed">
    <node id="n0">
      <data key="d0">green</data>
    </node>
    <node id="n1"/>
    <node id="n2">
      <data key="d0">blue</data>
    </node>
    <edge id="e0" source="n0" target="n2">
      <data key="d2">1.0</data>
    </edge>
  </graph>
</graphml>
r   rm   rq   rJ   rJ   rK   Útest_key_raise¯  s    zTestReadGraphML.test_key_raisec                 C   s<   d}t  | d¡¡}t tjtj|¡ t tjtj|¡ d S )Na5  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="d0" for="node" attr.name="color" attr.type="string">
    <default>yellow</default>
  </key>
  <key id="d1" for="edge" attr.name="weight" attr.type="double"/>
  <graph id="G" edgedefault="directed">
    <node id="n0">
      <data key="d0">green</data>
    </node>
    <node id="n1"/>
    <node id="n2">
      <data key="d0">blue</data>
    </node>
    <hyperedge id="e0" source="n0" target="n2">
       <endpoint node="n0"/>
       <endpoint node="n1"/>
       <endpoint node="n2"/>
    </hyperedge>
  </graph>
</graphml>
r   rm   rq   rJ   rJ   rK   Útest_hyperedge_raiseË  s    z$TestReadGraphML.test_hyperedge_raisec                 C   sn   d}t  | d¡¡}t |¡}ddg}t|jdd�ƒ|ks>t‚| d¡ t 	|¡}t|jdd�ƒ|ksjt‚d S )Naß  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G" edgedefault="directed">
    <node id="n0"/>
    <node id="n1"/>
    <edge id="e0" source="n0" target="n1"/>
    <edge id="e1" source="n0" target="n1"/>
  </graph>
</graphml>
r   )r   r   r   )r   r   r   T©Úkeysr   )
r,   r-   r.   r'   rU   rV   rY   rX   rZ   r[   ©r]   rr   rI   r   Úexpectedr^   rJ   rJ   rK   Útest_multigraph_keysé  s    


z$TestReadGraphML.test_multigraph_keysc                 C   sL  t  ¡ }| d¡ | d¡ | dddddifddddifdddd	d
œfdddddifdddddifdddddd
œfg¡ t ¡ }t  ||¡ | d¡ t j|t	d�}t
|jddd�|jddd�ƒsÈt‚|j|jksØt‚dd„ |j ¡ D ƒ}| d¡ t j|ttd�}||jk�st‚| d¡ | ¡ }t j|ttd�}||jk�sHt‚dS )zf
        Test that data and keys of edges are preserved on consequent
        write and reads
        r$   é   )r$   r|   ÚkeyZ	data_key1r
   Zdata_id2Z	data_key3Zdata_id3)r}   r
   ég   Z	data_key4éh   Zdata_id5éi   Z	data_key6Zdata_id7r   ©Ú	node_typeT)rT   rx   c                 S   s(   i | ] \}}t |ƒd d„ | ¡ D ƒ“qS )c                 S   s(   i | ] \}}t |ƒd d„ | ¡ D ƒ“qS )c                 S   s   i | ]\}}t |ƒ|“qS rJ   ©Ústr)Ú.0ZekeyÚddrJ   rJ   rK   Ú
<dictcomp>  s      zWTestReadGraphML.test_preserve_multi_edge_data.<locals>.<dictcomp>.<dictcomp>.<dictcomp>©r„   Úitems)r…   ZnbrZkey_dictrJ   rJ   rK   r‡     s   ÿ zLTestReadGraphML.test_preserve_multi_edge_data.<locals>.<dictcomp>.<dictcomp>rˆ   )r…   ÚnodeZnbr_dictrJ   rJ   rK   r‡     s
   ü þzATestReadGraphML.test_preserve_multi_edge_data.<locals>.<dictcomp>)r‚   Zedge_key_typeN)r'   r?   r)   r+   r,   r-   Úwrite_graphmlrZ   rU   Úintr   rY   rX   Ú_adjr‰   r„   Úreadr[   )r]   r   rI   r^   ZGadjZHHZ	string_fhrJ   rJ   rK   Útest_preserve_multi_edge_data   s:    

öÿ
"û

z-TestReadGraphML.test_preserve_multi_edge_datac                 C   sà  d}t  | d¡¡}tj|dd�}t| ¡ ƒdgks8t‚|jdddd	�sLt‚|j	d d
 dksbt‚|j	d d
 dksxt‚|j	d d
 dksŽt‚|j	d d dks¤t‚|j	d d dksºt‚|j	d d dksÐt‚|j	d d dksæt‚| 
d¡ t |¡}t| ¡ ƒdgk�st‚|d d d dk�s,t‚|j	d d
 dk�sDt‚|j	d d
 dk�s\t‚|j	d d
 dk�stt‚|j	d d dk�sŒt‚|j	d d dk�s¤t‚|j	d d dk�s¼t‚|j	d d dk�sÔt‚tj|dd�}t| ¡ ƒdgk�sút‚|jdddd	��st‚|j	d d
 dk�s(t‚|j	d d
 dk�s@t‚|j	d d
 dk�sXt‚t |¡}t| ¡ ƒdgk�szt‚|d d d dk�s”t‚|j	d d
 dk�s¬t‚|j	d d
 dk�sÄt‚|j	d d
 dk�sÜt‚d S )NaI  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:y="http://www.yworks.com/xml/graphml"
         xmlns:yed="http://www.yworks.com/xml/yed/3"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <!--Created by yFiles for Java 2.7-->
  <key for="graphml" id="d0" yfiles.type="resources"/>
  <key attr.name="url" attr.type="string" for="node" id="d1"/>
  <key attr.name="description" attr.type="string" for="node" id="d2"/>
  <key for="node" id="d3" yfiles.type="nodegraphics"/>
  <key attr.name="Description" attr.type="string" for="graph" id="d4">
    <default/>
  </key>
  <key attr.name="url" attr.type="string" for="edge" id="d5"/>
  <key attr.name="description" attr.type="string" for="edge" id="d6"/>
  <key for="edge" id="d7" yfiles.type="edgegraphics"/>
  <graph edgedefault="directed" id="G">
    <node id="n0">
      <data key="d3">
        <y:ShapeNode>
          <y:Geometry height="30.0" width="30.0" x="125.0" y="100.0"/>
          <y:Fill color="#FFCC00" transparent="false"/>
          <y:BorderStyle color="#000000" type="line" width="1.0"/>
          <y:NodeLabel alignment="center" autoSizePolicy="content"
           borderDistance="0.0" fontFamily="Dialog" fontSize="13"
           fontStyle="plain" hasBackgroundColor="false" hasLineColor="false"
           height="19.1328125" modelName="internal" modelPosition="c"
           textColor="#000000" visible="true" width="12.27099609375"
           x="8.864501953125" y="5.43359375">1</y:NodeLabel>
          <y:Shape type="rectangle"/>
        </y:ShapeNode>
      </data>
    </node>
    <node id="n1">
      <data key="d3">
        <y:ShapeNode>
          <y:Geometry height="30.0" width="30.0" x="183.0" y="205.0"/>
          <y:Fill color="#FFCC00" transparent="false"/>
          <y:BorderStyle color="#000000" type="line" width="1.0"/>
          <y:NodeLabel alignment="center" autoSizePolicy="content"
          borderDistance="0.0" fontFamily="Dialog" fontSize="13"
          fontStyle="plain" hasBackgroundColor="false" hasLineColor="false"
          height="19.1328125" modelName="internal" modelPosition="c"
          textColor="#000000" visible="true" width="12.27099609375"
          x="8.864501953125" y="5.43359375">2</y:NodeLabel>
          <y:Shape type="rectangle"/>
        </y:ShapeNode>
      </data>
    </node>
    <node id="n2">
      <data key="d6" xml:space="preserve"><![CDATA[description
line1
line2]]></data>
      <data key="d3">
        <y:GenericNode configuration="com.yworks.flowchart.terminator">
          <y:Geometry height="40.0" width="80.0" x="950.0" y="286.0"/>
          <y:Fill color="#E8EEF7" color2="#B7C9E3" transparent="false"/>
          <y:BorderStyle color="#000000" type="line" width="1.0"/>
          <y:NodeLabel alignment="center" autoSizePolicy="content"
          fontFamily="Dialog" fontSize="12" fontStyle="plain"
          hasBackgroundColor="false" hasLineColor="false" height="17.96875"
          horizontalTextPosition="center" iconTextGap="4" modelName="custom"
          textColor="#000000" verticalTextPosition="bottom" visible="true"
          width="67.984375" x="6.0078125" xml:space="preserve"
          y="11.015625">3<y:LabelModel>
          <y:SmartNodeLabelModel distance="4.0"/></y:LabelModel>
          <y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0"
          labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0"
          offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
        </y:GenericNode>
      </data>
    </node>
    <edge id="e0" source="n0" target="n1">
      <data key="d7">
        <y:PolyLineEdge>
          <y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
          <y:LineStyle color="#000000" type="line" width="1.0"/>
          <y:Arrows source="none" target="standard"/>
          <y:BendStyle smoothed="false"/>
        </y:PolyLineEdge>
      </data>
    </edge>
  </graph>
  <data key="d0">
    <y:Resources/>
  </data>
</graphml>
r   T©Zforce_multigraph)r   r   r   r   r   )r}   Úlabelr"   Ú2r   Ú3Z
shape_typeZ	rectanglezcom.yworks.flowchart.terminatorÚdescriptionzdescription
line1
line2r   r
   )r,   r-   r.   r'   rU   ÚlistrY   rX   Zhas_edgerW   rZ   r[   )r]   rT   rI   r   r^   rJ   rJ   rK   Útest_yfiles_extension-  sF    Z


z%TestReadGraphML.test_yfiles_extensionc                 C   s¦   d}t  | d¡¡}t |¡}t |¡}||fD ]p}|jd d sFt‚|jd d rXt‚|jd d rjt‚|jd d s|t‚|jd d rŽt‚|jd	 d s0t‚q0d S )
NaU  <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="d0" for="node" attr.name="test" attr.type="boolean">
    <default>false</default>
  </key>
  <graph id="G" edgedefault="directed">
    <node id="n0">
      <data key="d0">true</data>
    </node>
    <node id="n1"/>
    <node id="n2">
      <data key="d0">false</data>
    </node>
    <node id="n3">
      <data key="d0">FaLsE</data>
    </node>
    <node id="n4">
      <data key="d0">True</data>
    </node>
    <node id="n5">
      <data key="d0">0</data>
    </node>
    <node id="n6">
      <data key="d0">1</data>
    </node>
  </graph>
</graphml>
r   r   Útestr   r   r   r   r   )r,   r-   r.   r'   rU   r[   rW   rX   )r]   rr   rI   r   r^   r2   rJ   rJ   rK   Ú	test_bool­  s    

zTestReadGraphML.test_boolc           	      C   s–   d}d}d}||fD ]H}t  | d¡¡}t |¡}t |¡}||fD ]}|jd d sDt‚qDqt  | d¡¡}t 	tj
tj|¡ t 	tj
tj|¡ d S )Naþ  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key id="d0" for="node" attr.name="test" attr.type="boolean">
    <default>false</default>
  </key>
  <graph id="G">
    <node id="n0">
      <data key="d0">true</data>
    </node>
  </graph>
</graphml>
a  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml>
  <key id="d0" for="node" attr.name="test" attr.type="boolean">
    <default>false</default>
  </key>
  <graph id="G">
    <node id="n0">
      <data key="d0">true</data>
    </node>
  </graph>
</graphml>
a%  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="https://ghghgh">
  <key id="d0" for="node" attr.name="test" attr.type="boolean">
    <default>false</default>
  </key>
  <graph id="G">
    <node id="n0">
      <data key="d0">true</data>
    </node>
  </graph>
</graphml>
r   r   r—   )r,   r-   r.   r'   rU   r[   rW   rX   rn   ro   rp   )	r]   ZgoodÚbadZuglyrr   rI   r   r^   r2   rJ   rJ   rK   Útest_graphml_header_lineØ  s    

z(TestReadGraphML.test_graphml_header_linec                 C   sb   d}t  | d¡¡}t |¡}dd„ |jdd�D ƒ}t|ƒdksDt‚|D ]}|d d	ksHt‚qHd S )
Na‡I  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
  <!--Created by yEd 3.17-->
  <key attr.name="Description" attr.type="string" for="graph" id="d0"/>
  <key for="port" id="d1" yfiles.type="portgraphics"/>
  <key for="port" id="d2" yfiles.type="portgeometry"/>
  <key for="port" id="d3" yfiles.type="portuserdata"/>
  <key attr.name="CustomProperty" attr.type="string" for="node" id="d4">
    <default/>
  </key>
  <key attr.name="url" attr.type="string" for="node" id="d5"/>
  <key attr.name="description" attr.type="string" for="node" id="d6"/>
  <key for="node" id="d7" yfiles.type="nodegraphics"/>
  <key for="graphml" id="d8" yfiles.type="resources"/>
  <key attr.name="url" attr.type="string" for="edge" id="d9"/>
  <key attr.name="description" attr.type="string" for="edge" id="d10"/>
  <key for="edge" id="d11" yfiles.type="edgegraphics"/>
  <graph edgedefault="directed" id="G">
    <data key="d0"/>
    <node id="n0">
      <data key="d4"><![CDATA[CustomPropertyValue]]></data>
      <data key="d6"/>
      <data key="d7">
        <y:ShapeNode>
          <y:Geometry height="30.0" width="30.0" x="125.0" y="-255.4611111111111"/>
          <y:Fill color="#FFCC00" transparent="false"/>
          <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
          <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.634765625" x="9.1826171875" y="6.015625">2<y:LabelModel>
              <y:SmartNodeLabelModel distance="4.0"/>
            </y:LabelModel>
            <y:ModelParameter>
              <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
            </y:ModelParameter>
          </y:NodeLabel>
          <y:Shape type="rectangle"/>
        </y:ShapeNode>
      </data>
    </node>
    <node id="n1" yfiles.foldertype="group">
      <data key="d4"><![CDATA[CustomPropertyValue]]></data>
      <data key="d5"/>
      <data key="d6"/>
      <data key="d7">
        <y:ProxyAutoBoundsNode>
          <y:Realizers active="0">
            <y:GroupNode>
              <y:Geometry height="250.38333333333333" width="140.0" x="-30.0" y="-330.3833333333333"/>
              <y:Fill color="#F5F5F5" transparent="false"/>
              <y:BorderStyle color="#000000" type="dashed" width="1.0"/>
              <y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="140.0" x="0.0" y="0.0">Group 3</y:NodeLabel>
              <y:Shape type="roundrectangle"/>
              <y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
              <y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
              <y:BorderInsets bottom="1" bottomF="1.0" left="0" leftF="0.0" right="0" rightF="0.0" top="1" topF="1.0001736111111086"/>
            </y:GroupNode>
            <y:GroupNode>
              <y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
              <y:Fill color="#F5F5F5" transparent="false"/>
              <y:BorderStyle color="#000000" type="dashed" width="1.0"/>
              <y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 3</y:NodeLabel>
              <y:Shape type="roundrectangle"/>
              <y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
              <y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
              <y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
            </y:GroupNode>
          </y:Realizers>
        </y:ProxyAutoBoundsNode>
      </data>
      <graph edgedefault="directed" id="n1:">
        <node id="n1::n0" yfiles.foldertype="group">
          <data key="d4"><![CDATA[CustomPropertyValue]]></data>
          <data key="d5"/>
          <data key="d6"/>
          <data key="d7">
            <y:ProxyAutoBoundsNode>
              <y:Realizers active="0">
                <y:GroupNode>
                  <y:Geometry height="83.46111111111111" width="110.0" x="-15.0" y="-292.9222222222222"/>
                  <y:Fill color="#F5F5F5" transparent="false"/>
                  <y:BorderStyle color="#000000" type="dashed" width="1.0"/>
                  <y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="110.0" x="0.0" y="0.0">Group 1</y:NodeLabel>
                  <y:Shape type="roundrectangle"/>
                  <y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
                  <y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
                  <y:BorderInsets bottom="1" bottomF="1.0" left="0" leftF="0.0" right="0" rightF="0.0" top="1" topF="1.0001736111111086"/>
                </y:GroupNode>
                <y:GroupNode>
                  <y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
                  <y:Fill color="#F5F5F5" transparent="false"/>
                  <y:BorderStyle color="#000000" type="dashed" width="1.0"/>
                  <y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 1</y:NodeLabel>
                  <y:Shape type="roundrectangle"/>
                  <y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
                  <y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
                  <y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
                </y:GroupNode>
              </y:Realizers>
            </y:ProxyAutoBoundsNode>
          </data>
          <graph edgedefault="directed" id="n1::n0:">
            <node id="n1::n0::n0">
              <data key="d4"><![CDATA[CustomPropertyValue]]></data>
              <data key="d6"/>
              <data key="d7">
                <y:ShapeNode>
                  <y:Geometry height="30.0" width="30.0" x="50.0" y="-255.4611111111111"/>
                  <y:Fill color="#FFCC00" transparent="false"/>
                  <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
                  <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.634765625" x="9.1826171875" y="6.015625">1<y:LabelModel>
                      <y:SmartNodeLabelModel distance="4.0"/>
                    </y:LabelModel>
                    <y:ModelParameter>
                      <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
                    </y:ModelParameter>
                  </y:NodeLabel>
                  <y:Shape type="rectangle"/>
                </y:ShapeNode>
              </data>
            </node>
            <node id="n1::n0::n1">
              <data key="d4"><![CDATA[CustomPropertyValue]]></data>
              <data key="d6"/>
              <data key="d7">
                <y:ShapeNode>
                  <y:Geometry height="30.0" width="30.0" x="0.0" y="-255.4611111111111"/>
                  <y:Fill color="#FFCC00" transparent="false"/>
                  <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
                  <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.634765625" x="9.1826171875" y="6.015625">3<y:LabelModel>
                      <y:SmartNodeLabelModel distance="4.0"/>
                    </y:LabelModel>
                    <y:ModelParameter>
                      <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
                    </y:ModelParameter>
                  </y:NodeLabel>
                  <y:Shape type="rectangle"/>
                </y:ShapeNode>
              </data>
            </node>
          </graph>
        </node>
        <node id="n1::n1" yfiles.foldertype="group">
          <data key="d4"><![CDATA[CustomPropertyValue]]></data>
          <data key="d5"/>
          <data key="d6"/>
          <data key="d7">
            <y:ProxyAutoBoundsNode>
              <y:Realizers active="0">
                <y:GroupNode>
                  <y:Geometry height="83.46111111111111" width="110.0" x="-15.0" y="-179.4611111111111"/>
                  <y:Fill color="#F5F5F5" transparent="false"/>
                  <y:BorderStyle color="#000000" type="dashed" width="1.0"/>
                  <y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="110.0" x="0.0" y="0.0">Group 2</y:NodeLabel>
                  <y:Shape type="roundrectangle"/>
                  <y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
                  <y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/>
                  <y:BorderInsets bottom="1" bottomF="1.0" left="0" leftF="0.0" right="0" rightF="0.0" top="1" topF="1.0001736111111086"/>
                </y:GroupNode>
                <y:GroupNode>
                  <y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/>
                  <y:Fill color="#F5F5F5" transparent="false"/>
                  <y:BorderStyle color="#000000" type="dashed" width="1.0"/>
                  <y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 2</y:NodeLabel>
                  <y:Shape type="roundrectangle"/>
                  <y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/>
                  <y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/>
                  <y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/>
                </y:GroupNode>
              </y:Realizers>
            </y:ProxyAutoBoundsNode>
          </data>
          <graph edgedefault="directed" id="n1::n1:">
            <node id="n1::n1::n0">
              <data key="d4"><![CDATA[CustomPropertyValue]]></data>
              <data key="d6"/>
              <data key="d7">
                <y:ShapeNode>
                  <y:Geometry height="30.0" width="30.0" x="0.0" y="-142.0"/>
                  <y:Fill color="#FFCC00" transparent="false"/>
                  <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
                  <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.634765625" x="9.1826171875" y="6.015625">5<y:LabelModel>
                      <y:SmartNodeLabelModel distance="4.0"/>
                    </y:LabelModel>
                    <y:ModelParameter>
                      <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
                    </y:ModelParameter>
                  </y:NodeLabel>
                  <y:Shape type="rectangle"/>
                </y:ShapeNode>
              </data>
            </node>
            <node id="n1::n1::n1">
              <data key="d4"><![CDATA[CustomPropertyValue]]></data>
              <data key="d6"/>
              <data key="d7">
                <y:ShapeNode>
                  <y:Geometry height="30.0" width="30.0" x="50.0" y="-142.0"/>
                  <y:Fill color="#FFCC00" transparent="false"/>
                  <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
                  <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.634765625" x="9.1826171875" y="6.015625">6<y:LabelModel>
                      <y:SmartNodeLabelModel distance="4.0"/>
                    </y:LabelModel>
                    <y:ModelParameter>
                      <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
                    </y:ModelParameter>
                  </y:NodeLabel>
                  <y:Shape type="rectangle"/>
                </y:ShapeNode>
              </data>
            </node>
          </graph>
        </node>
      </graph>
    </node>
    <node id="n2">
      <data key="d4"><![CDATA[CustomPropertyValue]]></data>
      <data key="d6"/>
      <data key="d7">
        <y:ShapeNode>
          <y:Geometry height="30.0" width="30.0" x="125.0" y="-142.0"/>
          <y:Fill color="#FFCC00" transparent="false"/>
          <y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/>
          <y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="11.634765625" x="9.1826171875" y="6.015625">9<y:LabelModel>
              <y:SmartNodeLabelModel distance="4.0"/>
            </y:LabelModel>
            <y:ModelParameter>
              <y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/>
            </y:ModelParameter>
          </y:NodeLabel>
          <y:Shape type="rectangle"/>
        </y:ShapeNode>
      </data>
    </node>
    <edge id="n1::n1::e0" source="n1::n1::n0" target="n1::n1::n1">
      <data key="d10"/>
      <data key="d11">
        <y:PolyLineEdge>
          <y:Path sx="15.0" sy="-0.0" tx="-15.0" ty="-0.0"/>
          <y:LineStyle color="#000000" type="line" width="1.0"/>
          <y:Arrows source="none" target="standard"/>
          <y:BendStyle smoothed="false"/>
        </y:PolyLineEdge>
      </data>
    </edge>
    <edge id="n1::n0::e0" source="n1::n0::n1" target="n1::n0::n0">
      <data key="d10"/>
      <data key="d11">
        <y:PolyLineEdge>
          <y:Path sx="15.0" sy="-0.0" tx="-15.0" ty="-0.0"/>
          <y:LineStyle color="#000000" type="line" width="1.0"/>
          <y:Arrows source="none" target="standard"/>
          <y:BendStyle smoothed="false"/>
        </y:PolyLineEdge>
      </data>
    </edge>
    <edge id="e0" source="n1::n0::n0" target="n0">
      <data key="d10"/>
      <data key="d11">
        <y:PolyLineEdge>
          <y:Path sx="15.0" sy="-0.0" tx="-15.0" ty="-0.0"/>
          <y:LineStyle color="#000000" type="line" width="1.0"/>
          <y:Arrows source="none" target="standard"/>
          <y:BendStyle smoothed="false"/>
        </y:PolyLineEdge>
      </data>
    </edge>
    <edge id="e1" source="n1::n1::n1" target="n2">
      <data key="d10"/>
      <data key="d11">
        <y:PolyLineEdge>
          <y:Path sx="15.0" sy="-0.0" tx="-15.0" ty="-0.0"/>
          <y:LineStyle color="#000000" type="line" width="1.0"/>
          <y:Arrows source="none" target="standard"/>
          <y:BendStyle smoothed="false"/>
        </y:PolyLineEdge>
      </data>
    </edge>
  </graph>
  <data key="d8">
    <y:Resources/>
  </data>
</graphml>
r   c                 S   s   g | ]\}}|‘qS rJ   rJ   )r…   Ú_ÚxrJ   rJ   rK   Ú
<listcomp>*  s     zDTestReadGraphML.test_read_attributes_with_groups.<locals>.<listcomp>TrS   é	   ZCustomPropertyÚ )r,   r-   r.   r'   rU   rW   ÚlenrX   )r]   rT   rI   r   Z	node_datarJ   rJ   rK   Ú test_read_attributes_with_groups  s      
z0TestReadGraphML.test_read_attributes_with_groupsc                 C   st   d}t  | d¡¡}t |¡}dddifg}t|jdd�ƒ|ksDt‚| d¡ t 	|¡}t|jdd�ƒ|kspt‚d S )	NaÝ  <?xml version='1.0' encoding='utf-8'?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
         http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <key attr.name="cudfversion" attr.type="long" for="node" id="d6" />
  <graph edgedefault="directed">
    <node id="n1">
      <data key="d6">4284</data>
    </node>
  </graph>
</graphml>r   r   Zcudfversioni¼  TrS   r   )
r,   r-   r.   r'   rU   rV   rW   rX   rZ   r[   ry   rJ   rJ   rK   Útest_long_attribute_type/  s    


z(TestReadGraphML.test_long_attribute_typeN)rM   rN   rO   r`   rb   rc   rd   re   rk   rl   rs   rt   ru   rv   r{   r�   r–   r˜   rš   r¡   r¢   rJ   rJ   rJ   rK   rQ   ;  s*   - +3  &rQ   c                   @   sÂ   e Zd ZeejƒZedd„ ƒZdd„ Z	dd„ Z
dd„ Zd	d
„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+S ),ÚTestWriteGraphMLc                 C   s   t  ¡  t d¡}d S )Nú
lxml.etree)r   rL   rn   Úimportorskip)rH   r›   rJ   rJ   rK   rL   J  s    zTestWriteGraphML.setup_classc                 C   sF   zdd l }tjtjkst‚W n$ tk
r@   tjtjks<t‚Y nX d S ra   )Z
lxml.etreer'   r‹   Úwrite_graphml_lxmlrX   ÚImportErrorÚwrite_graphml_xml)r]   ZlxmlrJ   rJ   rK   Útest_write_interfaceO  s
    z%TestWriteGraphML.test_write_interfacec                 C   s¤   | j }d|jd< t ¡ }|  ||¡ | d¡ t |¡}t| 	¡ ƒt| 	¡ ƒksTt
‚t| ¡ ƒt| ¡ ƒkspt
‚t|jdd�ƒt|jdd�ƒks”t
‚| j d¡ d S )NÚthereÚhir   TrS   ©r(   r2   r,   r-   ÚwriterrZ   r'   rU   rV   rW   rX   rY   r/   ©r]   r   rI   r^   rJ   rJ   rK   Ú'test_write_read_simple_directed_graphmlW  s    


$z8TestWriteGraphML.test_write_read_simple_directed_graphmlc                 C   s&   t ƒ }| j}| ¡ }| ||g¡ d S ©N)r   r(   ÚcopyZ
add_graphs)r]   Zgmlwr   r^   rJ   rJ   rK   Útest_GraphMLWriter_add_graphsc  s    z.TestWriteGraphML.test_GraphMLWriter_add_graphsc                 C   s²   | j }d|jd< d|jd< t ¡ }| j||dd� | d¡ t |¡}t| 	¡ ƒt| 	¡ ƒksbt
‚t| ¡ ƒt| ¡ ƒks~t
‚t|jdd	�ƒt|jdd	�ƒks¢t
‚| j d¡ d S )
Nrª   r«   r"   r
   F)Zprettyprintr   TrS   r¬   r®   rJ   rJ   rK   Ú%test_write_read_simple_no_prettyprinti  s    



$z6TestWriteGraphML.test_write_read_simple_no_prettyprintc                 C   sî  ddl m} | j}t ¡ }| j||dd� | d¡ t |¡}| d¡ t	| 
¡ | 
¡ ƒs^t‚t| ¡ | ¡ ƒstt‚t|jdd�|jdd�ƒs’t‚| j d¡ ||ƒ}t| ¡ ƒ}t|ƒdksÂt‚dd„ |d d	… D ƒ}t|ƒd	ksèt‚d
|d ksøt‚d|d k�s
t‚d|d k�st‚d|d k�s.t‚d|d k�s@t‚d|d k�sRt‚t ¡ }t ||¡ | d¡ t |¡}t ¡ }	tj||	dd� |	 d¡ t |	¡}
tdd„ t|j
|
j
ƒD ƒƒ�sÈt‚tdd„ t|j|
jƒD ƒƒ�sêt‚d S )Nr   ©ÚparseT)Znamed_key_idsrS   é   c                 S   s   g | ]}|  ¡ ‘qS rJ   ©r‰   ©r…   ÚchildrJ   rJ   rK   r�   Š  s     zTTestWriteGraphML.test_write_read_attribute_named_key_ids_graphml.<locals>.<listcomp>é   )r
   r#   )ú	attr.namer#   )r
   r!   r$   )r»   r!   )r
   r    r|   )r»   r    c                 s   s   | ]\}}||kV  qd S r°   rJ   )r…   r   r   rJ   rJ   rK   Ú	<genexpr>   s     zSTestWriteGraphML.test_write_read_attribute_named_key_ids_graphml.<locals>.<genexpr>c                 s   s   | ]\}}||kV  qd S r°   rJ   )r…   r   r   rJ   rJ   rK   r¼   ¡  s     )Úxml.etree.ElementTreerµ   r6   r,   r-   r­   rZ   r'   rU   r   rW   rX   r   rY   r7   r•   Úgetrootr    r‹   Úallrf   )r]   rµ   r   rI   r^   ÚxmlÚchildrenrx   Zdefault_behavior_fhZnamed_key_ids_behavior_fhÚJrJ   rJ   rK   Ú/test_write_read_attribute_named_key_ids_graphmlv  s@    






"z@TestWriteGraphML.test_write_read_attribute_named_key_ids_graphmlc                 C   s  ddl m} | j}t ¡ }| j||dd� | d¡ t |¡}| d¡ t	| 
¡ | 
¡ ƒs^t‚t| ¡ | ¡ ƒstt‚t|jdd�|jdd�ƒs’t‚| j d¡ ||ƒ}t| ¡ ƒ}t|ƒdksÂt‚dd„ |d d	… D ƒ}t|ƒd	ksèt‚d
|d ksøt‚d
|d k�s
t‚d S )Nr   r´   T©Zinfer_numeric_typesrS   rº   c                 S   s   g | ]}|  ¡ ‘qS rJ   r·   r¸   rJ   rJ   rK   r�   ·  s     zSTestWriteGraphML.test_write_read_attribute_numeric_type_graphml.<locals>.<listcomp>r|   )z	attr.typeÚdoubler$   )r½   rµ   r8   r,   r-   r­   rZ   r'   rU   r   rW   rX   r   rY   r9   r•   r¾   r    )r]   rµ   r   rI   r^   rÀ   rÁ   rx   rJ   rJ   rK   Ú.test_write_read_attribute_numeric_type_graphml£  s$    


z?TestWriteGraphML.test_write_read_attribute_numeric_type_graphmlc                 C   sŠ   t  ¡ }| ddg¡ t ¡ \}}|  ||¡ t  |¡}| ¡ sDt‚t	|j
dd�|j
dd�ƒsbt‚|j|jksrt‚t |¡ t |¡ dS )zàWriting keys as edge id attributes means keys become strings.
        The original keys are stored as data, so read them back in
        if `str(key) == edge_id`
        This allows the adjacency to remain the same.
        ©ri   rj   r|   )ri   rj   rº   Trw   N)r'   r?   r+   ÚtempfileÚmkstempr­   rU   Úis_multigraphrX   r   rY   r�   ÚosÚcloseÚunlink©r]   r   ÚfdÚfnamer^   rJ   rJ   rK   Útest_more_multigraph_keys½  s    

z*TestWriteGraphML.test_more_multigraph_keysc                 C   sÈ   t jdd�}|jdddd� t  |ddddg¡ |jdddd	� d
di|jd< ddi|jd< t ¡ }|  ||¡ | 	d¡ t j
|td�}t| ¡ | ¡ ƒsžt‚t| ¡ | ¡ ƒs´t‚|j|jksÄt‚d S )NZFred)Únamer$   r   )r‘   r   r   r|   rº   r%   r   r   r   r   é   Zedge_defaultr�   )r'   r;   r)   Zadd_pathr*   r2   r,   r-   r­   rZ   rU   rŒ   r   rW   rX   r   rY   r®   rJ   rJ   rK   Útest_default_attributeÎ  s    
z'TestWriteGraphML.test_default_attributec                 C   sÀ   t  ¡ }|jddd� |jddd� |jdddd� |jdddd� t ¡ }|  ||¡ | d¡ t  |¡}|j	d d r~t
‚|j	d d dks”t
‚|jd d r¦t
‚|jd d dks¼t
‚d S )	Nr   F©Úspecialr   r   rÖ   ©r   r   r   ©r   r   r$   ©r'   r?   r)   r*   r,   r-   r­   rZ   rU   rW   rX   rY   r®   rJ   rJ   rK   Útest_mixed_type_attributesÝ  s    

z+TestWriteGraphML.test_mixed_type_attributesc                 C   sÈ   t  ¡ }|jddd� |jddd� |jdddd� |jdddd� t ¡ }|  ||¡ | d¡ t  |¡}|j	d d dks‚t
‚|j	d d dks˜t
‚|jd d dks®t
‚|jd d dksÄt
‚d S )	Nr   ZhellorÕ   r   r   rÖ   r×   rØ   rÙ   r®   rJ   rJ   rK   Ú%test_str_number_mixed_type_attributesì  s    

z6TestWriteGraphML.test_str_number_mixed_type_attributesc                 C   sÞ   t  d¡}t ¡ }|jd| d¡d� |jddd� |jdd| d¡d� |jdddd� t ¡ }|  	||¡ | 
d¡ t |¡}|jd d	 dks˜t‚|jd d	 dks®t‚|jd
 d	 dksÄt‚|jd d	 dksÚt‚d S )NÚnumpyr   r   rÕ   r   r$   r|   rº   rÖ   r×   rØ   )rn   r¥   r'   r?   r)   Zint64r*   r,   r-   r­   rZ   rU   rW   rX   rY   )r]   Únpr   rI   r^   rJ   rJ   rK   Ú%test_mixed_int_type_number_attributesû  s    


z6TestWriteGraphML.test_mixed_int_type_number_attributesc                 C   sx   t  d¡}| d¡}t ddd|ifg¡}t ¡ \}}|  ||¡ tj|t	d�}|j
|j
ks`t‚t |¡ t |¡ d S )NrÜ   ç333333@r$   r|   r   r�   )rn   r¥   Zfloat_r'   r;   rÈ   rÉ   r­   rU   rŒ   r�   rX   rË   rÌ   rÍ   )r]   rÝ   Úwtr   rÏ   rÐ   r^   rJ   rJ   rK   Útest_numpy_float  s    


z!TestWriteGraphML.test_numpy_floatc                 C   sà   t  ¡ }| ddg¡ t ¡ \}}|  ||¡ t  |¡}| ¡ rDt‚t j|dd�}| ¡ s^t‚t	 
|¡ t	 |¡ | ddd¡ t ¡ \}}|  ||¡ t  |¡}| ¡ s®t‚t j|dd�}| ¡ sÈt‚t	 
|¡ t	 |¡ d S )NrÇ   )rj   Úcrº   Tr�   ri   rj   ze-id)r'   r?   r+   rÈ   rÉ   r­   rU   rÊ   rX   rË   rÌ   rÍ   r*   rÎ   rJ   rJ   rK   Útest_multigraph_to_graph  s&    




z)TestWriteGraphML.test_multigraph_to_graphc                 C   sº  ddl m} t ¡ }| dddg¡ dd„ |jD ƒ}t ||d¡ t ¡ \}}| j	||dd	� tj
|dd	�}t |¡}t| ¡ | ¡ ƒsŒt‚t| ¡ | ¡ ƒs¢t‚t ||d
¡ t|jdd�|jdd�ƒsÎt‚||ƒ}t| ¡ ƒ}	t|	ƒdksòt‚dd„ | ¡  d¡D ƒ}
t|
ƒt| ¡ ƒk�s$t‚d |¡}t |¡}t| ¡ ƒt| ¡ ƒk�sVt‚t| ¡ ƒt| ¡ ƒk�stt‚t ||d
¡ t|jdd�|jdd�ƒ�s¢t‚t |¡ t |¡ d S )Nr   r´   ©ri   rj   ©rj   râ   ©ri   râ   c                 S   s   i | ]}|t |ƒ“qS rJ   rƒ   ©r…   ÚerJ   rJ   rK   r‡   3  s      zOTestWriteGraphML.test_write_generate_edge_id_from_attribute.<locals>.<dictcomp>Úeid©Zedge_id_from_attributer
   TrS   r|   c                 S   s   g | ]}|j d  ‘qS r	   ©Zattrib©r…   ÚedgerJ   rJ   rK   r�   E  s   ÿzOTestWriteGraphML.test_write_generate_edge_id_from_attribute.<locals>.<listcomp>ú..//{http://graphml.graphdrawing.org/xmlns}edgerŸ   )r½   rµ   r'   r;   r+   rY   Úset_edge_attributesrÈ   rÉ   r­   Úgenerate_graphmlrU   r   rW   rX   r   r•   r¾   r    ÚfindallrV   ÚvaluesÚjoinr[   rË   rÌ   rÍ   )r]   rµ   r   Úedge_attributesrÏ   rÐ   Ú	generatorr^   ÚtreerÁ   Úedge_idsrT   rÂ   rJ   rJ   rK   Ú*test_write_generate_edge_id_from_attribute.  s<    
ÿþ

 
z;TestWriteGraphML.test_write_generate_edge_id_from_attributec                 C   s:  ddl m} t ¡ }| ddddg¡ dd„ |jD ƒ}t ||d¡ t ¡ \}}| j	||dd	� tj
|dd	�}t |¡}| ¡ s„t‚tj|d
d�}| ¡ sžt‚t| ¡ | ¡ ƒs´t‚t| ¡ | ¡ ƒsÊt‚tdd„ |jd
d�D ƒƒt| ¡ ƒksôt‚tdd„ |jd
d�D ƒƒt| ¡ ƒk�s t‚||ƒ}t| ¡ ƒ}	t|	ƒdk�sFt‚dd„ | ¡  d¡D ƒ}
t|
ƒt| ¡ ƒk�sxt‚d |¡}t |¡}| ¡ �sšt‚t| ¡ | ¡ ƒ�s²t‚t| ¡ | ¡ ƒ�sÊt‚tdd„ |jd
d�D ƒƒt| ¡ ƒk�söt‚tdd„ |jd
d�D ƒƒt| ¡ ƒk�s"t‚t |¡ t |¡ d S )Nr   r´   rä   rå   ræ   c                 S   s   i | ]}|t |ƒ“qS rJ   rƒ   rç   rJ   rJ   rK   r‡   _  s      zZTestWriteGraphML.test_multigraph_write_generate_edge_id_from_attribute.<locals>.<dictcomp>ré   rê   Tr�   c                 s   s   | ]\}}}|  d ¡V  qdS ©ré   N©Úget©r…   ÚuÚvrT   rJ   rJ   rK   r¼   n  s     zYTestWriteGraphML.test_multigraph_write_generate_edge_id_from_attribute.<locals>.<genexpr>rS   c                 s   s   | ]\}}}|V  qd S r°   rJ   ©r…   rý   rþ   r}   rJ   rJ   rK   r¼   r  s     rw   r|   c                 S   s   g | ]}|j d  ‘qS r	   rë   rì   rJ   rJ   rK   r�   y  s   ÿzZTestWriteGraphML.test_multigraph_write_generate_edge_id_from_attribute.<locals>.<listcomp>rî   rŸ   c                 s   s   | ]\}}}|  d ¡V  qdS rù   rú   rü   rJ   rJ   rK   r¼   ‰  s     c                 s   s   | ]\}}}|V  qd S r°   rJ   rÿ   rJ   rJ   rK   r¼   �  s     )r½   rµ   r'   r?   r+   rY   rï   rÈ   rÉ   r­   rð   rU   rÊ   rX   r   rW   r   rV   rò   r•   r¾   r    rñ   ró   r[   rË   rÌ   rÍ   )r]   rµ   r   rô   rÏ   rÐ   rõ   r^   rö   rÁ   r÷   Zgraphml_datarÂ   rJ   rJ   rK   Ú5test_multigraph_write_generate_edge_id_from_attributeZ  sT    
ÿ
ÿÿþ

ÿÿ
zFTestWriteGraphML.test_multigraph_write_generate_edge_id_from_attributec           	      C   sÐ   t  d¡}| d¡}t ddd|ifg¡}t ¡ \}}|  ||¡ tj|t	d�}|j
|j
ks`t‚|d d d }|d d d }|t j|dd�ks–t‚t|ƒ|jks¨t‚t|ƒtks¸t‚t |¡ t |¡ d S ©	NrÜ   rß   r$   r|   r   r�   g�íµ ÷Æ°>)Úabs)rn   r¥   Úfloat64r'   r;   rÈ   rÉ   r­   rU   rŒ   rY   rX   ÚapproxÚtypeÚfloatrË   rÌ   rÍ   ©	r]   rÝ   rà   r   rÏ   rÐ   r^   ZwtGZwtHrJ   rJ   rK   Útest_numpy_float64”  s    


z#TestWriteGraphML.test_numpy_float64c           	      C   sÐ   t  d¡}| d¡}t ddd|ifg¡}t ¡ \}}|  ||¡ tj|t	d�}|j
|j
ks`t‚|d d d }|d d d }|t j|dd�ks–t‚t|ƒ|jks¨t‚t|ƒtks¸t‚t |¡ t |¡ d S r  )rn   r¥   Zfloat32r'   r;   rÈ   rÉ   r­   rU   rŒ   rY   rX   r  r  r  rË   rÌ   rÍ   r  rJ   rJ   rK   Útest_numpy_float32¤  s    


z#TestWriteGraphML.test_numpy_float32c                 C   sr   t  d¡}| j}| d¡|jd d< t ¡ \}}| j||dd� t 	|¡}|j
|j
ksZt‚t |¡ t |¡ d S )NrÜ   r   )r   r   r   TrÄ   )rn   r¥   r8   r  rY   rÈ   rÉ   r­   r'   rU   r�   rX   rË   rÌ   rÍ   )r]   rÝ   r   rÏ   rÐ   r^   rJ   rJ   rK   Útest_numpy_float64_inference´  s    


z-TestWriteGraphML.test_numpy_float64_inferencec                 C   sš   t  ¡ }tdƒtdƒ tdƒ }tdƒtdƒ tdƒ }t}|j|d|d� t ¡ \}}|  ||¡ t j||d	�}|j	|j	ks‚t
‚t |¡ t |¡ d S )
Ni(	  é{   i�  i§  i  iD  Z	Radiohead)r   r�   )r'   r;   Úchrr„   r*   rÈ   rÉ   r­   rU   r�   rX   rË   rÌ   rÍ   )r]   r   Zname1Zname2r‚   rÏ   rÐ   r^   rJ   rJ   rK   Útest_unicode_attributes¿  s    
z(TestWriteGraphML.test_unicode_attributesc                 C   sp   dd l }ddi}| |¡}t ¡ }||jd< t ¡ }|  ||¡ | d¡ t 	|¡}|jd |jd kslt
‚d S )Nr   ri   z{"a": "123"}r—   )ÚjsonÚdumpsr'   r;   r2   r,   r-   r­   rZ   rU   rX   )r]   r  ri   Úsar   rI   r^   rJ   rJ   rK   Útest_unicode_escapeÌ  s    



z$TestWriteGraphML.test_unicode_escapeN)rM   rN   rO   Ústaticmethodr'   r¦   r­   rP   rL   r©   r¯   r²   r³   rÃ   rÆ   rÑ   rÔ   rÚ   rÛ   rÞ   rá   rã   rø   r   r  r	  r
  r  r  rJ   rJ   rJ   rK   r£   G  s.   

-,:r£   c                   @   s"   e Zd ZeejƒZedd„ ƒZdS )ÚTestXMLGraphMLc                 C   s   t  ¡  d S r°   )r£   rL   )rH   rJ   rJ   rK   rL   Þ  s    zTestXMLGraphML.setup_classN)	rM   rN   rO   r  r'   r¨   r­   rP   rL   rJ   rJ   rJ   rK   r  Û  s   
r  c               	   C   sX   t  d¡ t ¡ } | jddddgd� t ¡ }t jtdd�� t 	| |¡ W 5 Q R X dS ©	úqTest that a detailed exception is raised when an attribute is of a type
    not supported by GraphML, e.g. a listr¤   r   r$   r|   )Úmy_list_attributeúGraphML does not support©ÚmatchN)
rn   r¥   r'   r;   r)   r,   r-   ro   Ú	TypeErrorr‹   ©r   rI   rJ   rJ   rK   Ú1test_exception_for_unsupported_datatype_node_attrã  s    
r  c               	   C   sZ   t  d¡ t ¡ } | jdddddgd� t ¡ }t jtdd�� t 	| |¡ W 5 Q R X dS r  )
rn   r¥   r'   r;   r*   r,   r-   ro   r  r‹   r  rJ   rJ   rK   Ú1test_exception_for_unsupported_datatype_edge_attrï  s    
r  c               	   C   sT   t  d¡ t ¡ } dddg| jd< t ¡ }t jtdd�� t 	| |¡ W 5 Q R X dS )	r  r¤   r   r$   r|   r  r  r  N)
rn   r¥   r'   r;   r2   r,   r-   ro   r  r‹   r  rJ   rJ   rK   Ú2test_exception_for_unsupported_datatype_graph_attrû  s    
r  )r,   rË   rÈ   rn   Znetworkxr'   Znetworkx.readwrite.graphmlr   Znetworkx.utilsr   r   r   rQ   r£   r  r  r  r  rJ   rJ   rJ   rK   Ú<module>   s0     1         