o
    ִiB
                     @   sl   d dl Z d dlZd dlZd dlm  mZ d dlmZ	 G dd dZ
G dd dZdd ZG dd	 d	ZdS )
    Nc                   @   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 )TestKFactorc                 C   s*   t d}t|d}|j|jksJ d S N      )gencycle_graphregk_factoredges)selfgf r   Y/home/kuhnn/.local/lib/python3.10/site-packages/networkx/algorithms/tests/test_regular.pytest_k_factor_trivial
   s   
z!TestKFactor.test_k_factor_trivialc                 C   s`   t dd}t|d}| D ]}||d |d sJ q| D ]
\}}|dks-J q#d S )Nr   r   r      )r   grid_2d_graphr   r	   r
   has_edgedegreer   r   g_kfedge_r   r   r   r   test_k_factor1   s   zTestKFactor.test_k_factor1c                 C   ^   t d}t|d}| D ]}||d |d sJ q| D ]
\}}|dks,J q"d S )N      r   r   r   complete_graphr   r	   r
   r   r   r   r   r   r   test_k_factor2   s   
zTestKFactor.test_k_factor2c                 C   sJ   t dd}ttj t|d W d    d S 1 sw   Y  d S )Nr   r   )r   r   pytestraisesnxNetworkXUnfeasibler   r	   r   r   r   r   r   test_k_factor3   s   "zTestKFactor.test_k_factor3c                 C   sL   t jdd}ttj t|d W d    d S 1 sw   Y  d S r   )	r   latticehexagonal_lattice_graphr    r!   r"   r#   r   r	   r$   r   r   r   test_k_factor4$   s   "zTestKFactor.test_k_factor4c                 C   r   )Nr   r   r   r   r   r   r   r   r   test_k_factor5*   s   
zTestKFactor.test_k_factor5N)	__name__
__module____qualname__r   r   r   r%   r(   r)   r   r   r   r   r   	   s    r   c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestIsRegularc                 C      t d}t|sJ d S )Nr   )r   r   r   
is_regularr$   r   r   r   test_is_regular15      
zTestIsRegular.test_is_regular1c                 C   r.   N   )r   r   r   r/   r$   r   r   r   test_is_regular29   r1   zTestIsRegular.test_is_regular2c                 C   s   t dd}t|rJ d S r2   )r   lollipop_graphr   r/   r$   r   r   r   test_is_regular3=   s   zTestIsRegular.test_is_regular3c                 C   s(   t  }|g d t|sJ d S )N))r   r   )r   r   )r   r   )r"   DiGraphadd_edges_fromr   r/   r$   r   r   r   test_is_regular4A   s   zTestIsRegular.test_is_regular4N)r*   r+   r,   r0   r4   r6   r9   r   r   r   r   r-   4   s
    r-   c                  C   sH   t  } tjt jdd t |  W d    d S 1 sw   Y  d S )NzGraph has no nodes)match)r"   Graphr    r!   NetworkXPointlessConceptr/   )Gr   r   r   "test_is_regular_empty_graph_raisesG   s   "r>   c                   @   s$   e Zd Zdd Zdd Zdd ZdS )TestIsKRegularc                 C   s.   t d}t|dsJ t|drJ d S )Nr   r   r   )r   r   r   is_k_regularr$   r   r   r   test_is_k_regular1N   s   
z!TestIsKRegular.test_is_k_regular1c                 C   s>   t d}t|dsJ t|drJ t|drJ d S )Nr3   r   r   r   )r   r   r   r@   r$   r   r   r   test_is_k_regular2S   s   
z!TestIsKRegular.test_is_k_regular2c                 C   s0   t dd}t|drJ t|drJ d S )Nr3   r   )r   r5   r   r@   r$   r   r   r   test_is_k_regular3Y   s   z!TestIsKRegular.test_is_k_regular3N)r*   r+   r,   rA   rB   rC   r   r   r   r   r?   M   s    r?   )r    networkxr"   networkx.algorithms.regular
algorithmsregularr   networkx.generators
generatorsr   r   r-   r>   r?   r   r   r   r   <module>   s    +