
    VhT                     :    d Z ddlZddlZddlmZ  G d de      Zy)zOriginal NetworkX graph tests    N   )HistoricalTestsc                   R    e Zd Zed        Zd Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zy)TestDiGraphHistoricalc                 V    t        j                          t        j                  | _        y N)r   setup_classnxDiGraphG)clss    ^/home/dcms/DCMS/lib/python3.12/site-packages/networkx/classes/tests/test_digraph_historical.pyr	   z!TestDiGraphHistorical.setup_class   s    ##%

    c           	         | j                         }|j                  d       |j                  g d       t        d |j	                         D              g dk(  sJ t        |j	                               ddddddddk(  sJ y )	NGJK)AB)r   C)r   D)r   r   )r   r   c              3   &   K   | ]	  \  }}|  y wr    .0nds      r   	<genexpr>z7TestDiGraphHistorical.test_in_degree.<locals>.<genexpr>        2DAqa2   r   r   r   r   r      r!   r   r!   r   r   r   r   r   r   KJ)r   add_nodes_fromadd_edges_fromsorted	in_degreedictselfr   s     r   test_in_degreez$TestDiGraphHistorical.test_in_degree   s    FFH		UV2AKKM226KKKKAKKM"'
 
 	
 
r   c           	         | j                         }|j                  d       |j                  g d       t        d |j	                         D              g dk(  sJ t        |j                               ddddddddk(  sJ y )	Nr   r   c              3   &   K   | ]	  \  }}|  y wr   r   )r   kvs      r   r   z8TestDiGraphHistorical.test_out_degree.<locals>.<genexpr>$   r   r   r    r!   r   r   r"   )r   r%   r&   r'   r(   r)   
out_degreer*   s     r   test_out_degreez%TestDiGraphHistorical.test_out_degree    s    FFH		UV2AKKM226KKKKALLN#(
 
 	
 
r   c                 N   t        j                         }|j                  ddg       t        d |j	                  ddg      D              ddgk(  sJ t        d |j                  ddg      D              ddgk(  sJ t        d	 |j                  ddg      D              ddgk(  sJ y )
N)r      )r   r!   c              3   &   K   | ]	  \  }}|  y wr   r   r   s      r   r   z<TestDiGraphHistorical.test_degree_digraph.<locals>.<genexpr>2   s     9DAqa9r   r   r4   r   c              3   &   K   | ]	  \  }}|  y wr   r   r   s      r   r   z<TestDiGraphHistorical.test_degree_digraph.<locals>.<genexpr>3   s     :DAqa:r   r!   c              3   &   K   | ]	  \  }}|  y wr   r   r   s      r   r   z<TestDiGraphHistorical.test_degree_digraph.<locals>.<genexpr>4   s     6DAqa6r   )r
   r   r&   r'   r(   r1   degree)r+   Hs     r   test_degree_digraphz)TestDiGraphHistorical.test_degree_digraph/   s    JJL	'6*+9AKKB$899aVCCC:ALL!R$9::q!fDDD6AHHaW$5661a&@@@r   c                    | j                         }|j                  d       |j                  g d       t        |j	                  d            dgk(  sJ t        |d         dgk(  sJ t        |j	                  d            ddgk(  sJ t        j                  t        j                  |j                  d       t        j                  t        j                  |j                  d       y )Nr   r   r   r   r   r   j)	r   r%   r&   r'   	neighborspytestraisesr
   NetworkXErrorr*   s     r   test_neighborsz$TestDiGraphHistorical.test_neighbors6   s    FFH		UVakk#&'C5000af~#&&&akk#&'C:555b&&S9b&&S9r   c                 f   | j                         }|j                  d       |j                  g d       t        |j	                  d            ddgk(  sJ t        |j	                  d            ddgk(  sJ t        |j	                  d            g k(  sJ t        |j	                  d            g k(  sJ t        |j	                  d            g k(  sJ t        j                  t        j                  |j                  d       t        j                  t        j                  |j                  d       y )	Nr   r   r   r   r   r   r   r<   )	r   r%   r&   r'   
successorsr>   r?   r
   r@   r*   s     r   test_successorsz%TestDiGraphHistorical.test_successorsA   s    FFH		UVall3'(S#J666all3'(S#J666all3'(B...all3'(B...all3'(B...b&&c:b&&c:r   c                    | j                         }|j                  d       |j                  g d       t        |j	                  d            ddgk(  sJ t        |j	                  d            ddgk(  sJ t        |j	                  d            g k(  sJ t        |j	                  d            g k(  sJ t        |j	                  d            g k(  sJ t        |j	                  d            g k(  sJ t        |j                  d            g k(  sJ t        j                  t        j                  |j                  d       t        j                  t        j                  |j                  d       y )	Nr   r   r   r   r   r   r   r<   )
r   r%   r&   r'   predecessorsrC   r>   r?   r
   r@   r*   s     r   test_predecessorsz'TestDiGraphHistorical.test_predecessorsM   s*   FFH		UVannS)*sCj888annS)*sCj888annS)*b000annS)*b000annS)*b000annS)*b000all3'(B...b&&<b&&<r   c                    t        j                  d      }|j                         }|j                         }t        j                  ||      sJ t        |j                               t        |j                               k(  sJ y )N
   )r
   complete_graphto_directedreverseis_isomorphicr'   edges)r+   r   r9   HRs       r   test_reversez"TestDiGraphHistorical.test_reverse\   sb    b!MMOYY[2&&&aggi F288:$6666r   c                     t        j                         }t        d      D cg c]  }|j                  ||dz          }}|j	                         }t        d      D ]  }|j                  |dz   |      rJ  y c c}w )N   r   )r
   r   rangeadd_edgerL   has_edge)r+   r9   ufoorO   s        r   test_reverse2z#TestDiGraphHistorical.test_reverse2c   sn    JJL-21X6qzz!QU#66YY[q 	)A;;q1ua(((	) 7s   A8c                     t        j                         }|j                  g d       |j                         }t	        |j                               g dk(  sJ y )N)r   r!         )r
   r   r%   rL   r'   nodes)r+   r9   rO   s      r   test_reverse3z#TestDiGraphHistorical.test_reverse3j   s?    JJL	&YY[bhhj!\111r   N)__name__
__module____qualname__classmethodr	   r,   r2   r:   rA   rD   rG   rP   rX   r]   r   r   r   r   r   
   sB     
 
A	:
;=7)2r   r   )__doc__r>   networkxr
   historical_testsr   r   r   r   r   <module>re      s    #   -d2O d2r   