a
    1b
                     @   s|   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	 d dl
mZ d dlmZ G dd	 d	ZG d
d dZdS )    )groupbyN)nodes_equaledges_equal)graph_atlas)graph_atlas_g)
NUM_GRAPHS)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   s6   t t td W d    n1 s(0    Y  d S )N)pytestraises
ValueErrorr   self r   Clib/python3.9/site-packages/networkx/generators/tests/test_atlas.pytest_index_too_small   s    z#TestAtlasGraph.test_index_too_smallc                 C   s6   t t tt W d    n1 s(0    Y  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J t| ddgs4J d S )N      )r      )r      )r   r   Znodesranger   Z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J | dks*J | j d }| dksDJ | dksTJ d S )Nr      r   )r"   number_of_nodesnumber_of_edgesr   r   r   r   
test_sizes%   s    

zTestAtlasGraphG.test_sizesc                 C   s2   t | jD ]"\}}t|jdd  |ks
J q
d S Nr   )	enumerater"   intname)r   ir   r   r   r   
test_names.   s    zTestAtlasGraphG.test_namesc                 C   s.   t tt| jD ]\}}||d ksJ qd S r)   )r   maplenr"   )r   Zn1Zn2r   r   r   test_nondecreasing_nodes2   s    z(TestAtlasGraphG.test_nondecreasing_nodesc                 C   sH   t | jtjdD ]2\}}tttj|D ]\}}||d ks(J q(qd S )Nkeyr   )r   r"   nxr&   r   r/   r'   )r   ngroupZm1Zm2r   r   r   test_nondecreasing_edges7   s    z(TestAtlasGraphG.test_nondecreasing_edgesc           	      C   s   g d}t | jtjdD ]|\}}t |tjdD ]d\}}t|D ]R\}}|j|jf|v rXq>tdd | D }tdd | D }||ks>J q>q.qd S )N))ZG55ZG56)ZG1007ZG1008)ZG1012ZG1013r2   c                 s   s   | ]\}}|V  qd S r   r   .0vdr   r   r   	<genexpr>K       zETestAtlasGraphG.test_nondecreasing_degree_sequence.<locals>.<genexpr>c                 s   s   | ]\}}|V  qd S r   r   r8   r   r   r   r<   L   r=   )	r   r"   r4   r&   r'   r   r,   sortedZdegree)	r   
exceptionsr5   r6   mZG1ZG2Zd1Zd2r   r   r   "test_nondecreasing_degree_sequence>   s    z2TestAtlasGraphG.test_nondecreasing_degree_sequenceN)r   r   r   r    classmethodr$   r(   r.   r1   r7   rA   r   r   r   r   r!      s   
	r!   )	itertoolsr   r   Znetworkxr4   Znetworkx.utilsr   r   r   r   Znetworkx.generators.atlasr   r   r	   r!   r   r   r   r   <module>   s   