U
    ?h	                     @   sl   d dl mZ d dlZd dlZd dlmZmZ d dlmZ d dl	m
Z
mZmZ G dd dZG dd	 d	ZdS )
    )groupbyN)graph_atlasgraph_atlas_g)
NUM_GRAPHS)edges_equalnodes_equalpairwisec                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	TestAtlasGraphz:Unit tests for the :func:`~networkx.graph_atlas` function.c              	   C   s"   t t td W 5 Q R X d S )N)pytestraises
ValueErrorr   self r   V/var/www/html/venv/lib/python3.8/site-packages/networkx/generators/tests/test_atlas.pytest_index_too_small   s    z#TestAtlasGraph.test_index_too_smallc              	   C   s"   t t tt W 5 Q R X d S N)r   r   r   r   r   r   r   r   r   test_index_too_large   s    z#TestAtlasGraph.test_index_too_largec                 C   s8   t d}t| tdstt| ddgs4td S )N      )r      )r      )r   r   ZnodesrangeAssertionErrorr   edgesr   Gr   r   r   
test_graph   s    zTestAtlasGraph.test_graphN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r	      s   r	   c                   @   sD   e Zd ZdZedd Zdd Zdd Zdd	 Zd
d Z	dd Z
dS )TestAtlasGraphGz<Unit tests for the :func:`~networkx.graph_atlas_g` function.c                 C   s   t  | _d S r   )r   GAG)clsr   r   r   setup_class   s    zTestAtlasGraphG.setup_classc                 C   sX   | j d }| dkst| dks*t| j d }| dksDt| dksTtd S )Nr      r   )r$   number_of_nodesr   number_of_edgesr   r   r   r   
test_sizes#   s    

zTestAtlasGraphG.test_sizesc                 C   s2   t | jD ]"\}}t|jdd  |ks
tq
d S Nr   )	enumerater$   intnamer   )r   ir   r   r   r   
test_names,   s    zTestAtlasGraphG.test_namesc                 C   s.   t tt| jD ]\}}||d kstqd S r+   )r   maplenr$   r   )r   Zn1Zn2r   r   r   test_nondecreasing_nodes0   s    z(TestAtlasGraphG.test_nondecreasing_nodesc                 C   sH   t | jtjdD ]2\}}tttj|D ]\}}||d ks(tq(qd S )Nkeyr   )r   r$   nxr(   r   r1   r)   r   )r   ngroupm1m2r   r   r   test_nondecreasing_edges5   s    z(TestAtlasGraphG.test_nondecreasing_edgesc           	      C   s   dddg}t | jtjdD ]|\}}t |tjdD ]d\}}t|D ]R\}}|j|jf|krZq@tdd | D }tdd | D }||ks@t	q@q0qd S )N)ZG55ZG56)ZG1007ZG1008)ZG1012ZG1013r4   c                 s   s   | ]\}}|V  qd S r   r   .0vdr   r   r   	<genexpr>I   s     zETestAtlasGraphG.test_nondecreasing_degree_sequence.<locals>.<genexpr>c                 s   s   | ]\}}|V  qd S r   r   r<   r   r   r   r@   J   s     )
r   r$   r6   r(   r)   r   r.   sortedZdegreer   )	r   
exceptionsr7   r8   mZG1ZG2Zd1Zd2r   r   r   "test_nondecreasing_degree_sequence<   s    
z2TestAtlasGraphG.test_nondecreasing_degree_sequenceN)r   r    r!   r"   classmethodr&   r*   r0   r3   r;   rD   r   r   r   r   r#      s   
	r#   )	itertoolsr   r   Znetworkxr6   r   r   Znetworkx.generators.atlasr   Znetworkx.utilsr   r   r   r	   r#   r   r   r   r   <module>   s   