
    Vh                     Z   d Z ddlZddlZddlmZ ddlZddlZd Zd Z	d Z
 ej                  d      d	        Z ej                  d      d
        Z	 ddlZdZ	 ddlZdZ	 ddlZdZ	 ddlZdZ	 ddlZdZ	 ddlZdZ	 ddlZdZ g Z!g dZ"g dZ#ddgZ$dgZ%dgZ&dgZ'dgZ(ese!e"z  Z!ese!e#z  Z!ese!e$z  Z!ese!e%z  Z!ese!e&z  Z!ese!e'z  Z!e se!e(z  Z!yy# e$ r dZY w xY w# e$ r dZY w xY w# e$ r dZY w xY w# e$ r dZY w xY w# e$ r dZY w xY w# e$ r dZY w xY w# e$ r dZ Y w xY w)ax  
Testing
=======

General guidelines for writing good tests:

- doctests always assume ``import networkx as nx`` so don't add that
- prefer pytest fixtures over classes with setup methods.
- use the ``@pytest.mark.parametrize``  decorator
- use ``pytest.importorskip`` for numpy, scipy, pandas, and matplotlib b/c of PyPy.
  and add the module to the relevant entries below.

    N)entry_pointsc                     | j                  dddd       | j                  ddd d       | j                  d	ddd
       y )N	--runslow
store_trueFzrun slow tests)actiondefaulthelp	--backendstorezGRun tests with a backend by auto-converting nx graphs to backend graphs--fallback-to-nxz[Run nx function if a backend doesn't implement a dispatchable function (use with --backend))	addoption)parsers    A/home/dcms/DCMS/lib/python3.12/site-packages/networkx/conftest.pypytest_addoptionr      sc    
L%>N   V	    	      c                    | j                  dd       | j                  d      }|t        j                  j	                  d      }t        dd      }|st        j                  d       || _        |r_|d   t        j                  j                  j                  d<   i t        j                  j                  j                  d<   t        j                  j                  ddt        j                  j                         it        j                  j                  t        j                  _        | j                  d	      }|st        j                  j	                  d
      }t        |      t        j                  _        t        j                  j                  j"                  j$                  t        j                  j                  j"                  _        y y )Nmarkerszslow: mark test as slow to runr
   NETWORKX_TEST_BACKENDnx_loopbackznetworkx.backends)namegroupac  

             WARNING: Mixed NetworkX configuration! 

        This environment has mixed configuration for networkx.
        The test object nx_loopback is not configured correctly.
        You should not be seeing this message.
        Try `pip install -e .`, or change your PYTHONPATH
        Make sure python finds the networkx repo you are testing

r   NETWORKX_FALLBACK_TO_NX )addinivalue_line	getoptionosenvirongetr   warningswarnbackendnxutilsbackendsbackend_infoConfigconfigboolfallback_to_nx_dispatchable_call_if_any_backends_installed__call__)r'   r!   loopback_epr)   s       r   pytest_configurer.   +   sS   
I'GH{+G**..!89M9LMKS	
 FN 5@4N""=18:&&}5XX__ 
)
ii  
		  ))*<=ZZ^^,EFN#'#7		 HH++KK 	''0 r   c                 h   | j                   r| j                   }|dk7  rdt        j                  j                  j                  _        |gt        j                  j                  _        |gt        j                  j                  _	        t        j                  j                  j                  |   j                         }t        |d      r t        |d      |       | j                  d      ry t        j                  j!                  d      }|D ]"  }d|j"                  v s|j%                  |       $ y )NnetworkxTon_start_testsr   zneed --runslow option to run)reasonslow)r!   r"   r#   r$   r*   _is_testingr'   backend_priorityalgos
generatorsloadhasattrgetattrr   pytestmarkskipkeywords
add_marker)r'   itemsbackend_namer!   	skip_slowitems         r   pytest_collection_modifyitemsrD   N   s     ~~ ~~:%:>BHH++70<~BII&&,5ANBII&&1hh''00>CCEGw 012!1259$  (F GI 'T]]"OOI&'r   T)autousec                      t        j                  dt        d       t        j                  dt        d       t        j                  dt        d       t        j                  dt        d       y )Nignorez:Exited (at iteration \d+|postprocessing) with accuracies.*)categorymessagez

The `normalized`z

`compute_v_structureszKeyword argument 'link')r   filterwarningsUserWarningDeprecationWarningr   r   r   set_warningsrM   g   sd    M
 -7M -7R -7Pr   c                     t         | d<   y )Nr"   )r"   )doctest_namespaces    r   add_nxrP   y   s     dr   F).algorithms/approximation/traveling_salesman.pyz/algorithms/centrality/current_flow_closeness.py"algorithms/centrality/laplacian.py!algorithms/node_classification.pyzalgorithms/non_randomness.pyalgorithms/polynomials.pyz"algorithms/shortest_paths/dense.pyalgorithms/structuralholes.pyalgorithms/tree/mst.pyzdrawing/nx_latex.pygenerators/expanders.pylinalg/bethehessianmatrix.pylinalg/laplacianmatrix.pyzutils/misc.py)&rQ   z'algorithms/assortativity/correlation.pyz"algorithms/assortativity/mixing.pyz!algorithms/assortativity/pairs.pyzalgorithms/bipartite/matrix.pyz algorithms/bipartite/spectral.pyz%algorithms/bipartite/link_analysis.pyz1algorithms/centrality/current_flow_betweenness.pyz8algorithms/centrality/current_flow_betweenness_subset.pyz$algorithms/centrality/eigenvector.pyzalgorithms/centrality/katz.pyrR   z%algorithms/centrality/second_order.pyz%algorithms/centrality/subgraph_alg.pyz!algorithms/communicability_alg.pyz algorithms/community/divisive.pyzalgorithms/distance_measures.pyz$algorithms/link_analysis/hits_alg.pyz(algorithms/link_analysis/pagerank_alg.pyrS   zalgorithms/similarity.pyrU   rV   zalgorithms/walks.pyconvert_matrix.pyzdrawing/layout.pydrawing/nx_pylab.pyz"generators/spectral_graph_forge.pyzgenerators/geometric.pyrW   zlinalg/algebraicconnectivity.pyzlinalg/attrmatrix.pyrX   zlinalg/graphmatrix.pyrY   zlinalg/modularitymatrix.pyzlinalg/spectrum.pyzutils/rcm.pyr[   zgenerators/classic.pyrZ   zdrawing/nx_agraph.pyzdrawing/nx_pydot.pyrT   ))__doc__r   r   importlib.metadatar   r;   r0   r"   r   r.   rD   fixturerM   rP   numpynp	has_numpyImportErrorscipysp	has_scipy
matplotlibmplhas_matplotlibpandaspd
has_pandas
pygraphvizhas_pygraphvizpydot	has_pydotsympy	has_sympycollect_ignoreneeds_numpyneeds_scipyneeds_matplotlibneeds_pandasneeds_pygraphvizneeds_pydotneeds_sympyr   r   r   <module>rz      s    
  +  & 
F'2  " ! !IINJNII  'P *+BC #$*+ $%*+k!Nk!N&&Nl"N&&Nk!Nk!N y  I  I  N  J  N  I  Is~   C C #C, *C9 1D 8D ?D  CCC)(C),C65C69DDDDDD D*)D*