
    9i                     `   d Z ddl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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    [/var/www/html/backtest/airagagent/rag_env/lib/python3.12/site-packages/networkx/conftest.pypytest_addoptionr      sc    
L%>N   V	    	      c                    | j                  dd       | j                  d      }|t        j                  j	                  d      }|r|gt
        j                  j                  j                  _	        | j                  d      }|st        j                  j	                  d      }t        |      t
        j                  j                  j                  _        t        j                  dk  rd t               d	   D        }nt        d
d	      }|r:t        t!        |            t
        j                  j                  j                  d
<   y t#        j$                  d       y )Nmarkerszslow: mark test as slow to runr
   NETWORKX_TEST_BACKENDr   NETWORKX_FALLBACK_TO_NX)   
   c              3   @   K   | ]  }|j                   d k(  s|  yw)nx-loopbackN)name).0eps     r   	<genexpr>z#pytest_configure.<locals>.<genexpr>8   s       
=@XB
s   znetworkx.backendsr   )r   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

)addinivalue_line	getoptionosenvirongetnetworkxutilsbackends	_dispatch_automatic_backendsbool_fallback_to_nxsysversion_infor   nextiterwarningswarn)configbackendfallback_to_nxr&   s       r   pytest_configurer4   +   s   
I'GH{+G**..!89AH	))=))*<=ZZ^^,EFN<@<P))9
'!
%(;<
  ]:MN:>tH~:N((7S	
r   c                    dt         j                  j                  j                  _        t         j                  j                  j                  j
                  x}rVt         j                  j                  j                  |d      j                         }t        |d      r t        |d      |       | j                  d      ry t        j                  j                  d      }|D ]"  }d|j                  v s|j                  |       $ y )NTr   on_start_testsr   zneed --runslow option to run)reasonslow)r$   r%   r&   r'   _is_testingr(   loadhasattrgetattrr    pytestmarkskipkeywords
add_marker)r1   itemsautomatic_backendsr2   	skip_slowitems         r   pytest_collection_modifyitemsrF   J   s     59HNN%%1%^^44>>RRRR ..))223Ea3HINNP7,-.GG-.u5$  (F GI 'T]]"OOI&'r   T)autousec                  4   t        j                  dt        d       t        j                  dt        d       t        j                  dt        d       t        j                  dt        d       t        j                  dt        d       t        j                  dt        d       t        j                  dt        d	       t        j                  dt        d
       t        j                  dt        d       t        j                  dt        d       y )Nignoreznx.nx_pydot)categorymessagez'single_target_shortest_path_length willzshortest_path for all_pairsz
forest_str is deprecatedz

random_treezEdmonds has been deprecatedz(MultiDiGraph_EdgeKey has been deprecatedz

The `normalized`zfunction `join` is deprecatedz)

strongly_connected_components_recursive)r/   filterwarningsDeprecationWarning r   r   set_warningsrO   _   s    -} #9
 #-
 -7S -7H -7T #:
 -7M -7V #=r   c                 b    t         | d<   	 dd l}|j                  d       y # t        $ r Y y w xY w)Nnxr   z1.21)legacy)r$   numpyset_printoptionsImportError)doctest_namespacenps     r   add_nxrX      s8    &d
6* s   " 	..F)	.algorithms/approximation/traveling_salesman.pyz/algorithms/centrality/current_flow_closeness.py!algorithms/node_classification.pyzalgorithms/non_randomness.pyz"algorithms/shortest_paths/dense.pylinalg/bethehessianmatrix.pyzlinalg/laplacianmatrix.pyzutils/misc.py"algorithms/centrality/laplacian.py)rY   z'algorithms/assortativity/correlation.pyz"algorithms/assortativity/mixing.pyz!algorithms/assortativity/pairs.pyzalgorithms/bipartite/matrix.pyz algorithms/bipartite/spectral.pyz1algorithms/centrality/current_flow_betweenness.pyz8algorithms/centrality/current_flow_betweenness_subset.pyz$algorithms/centrality/eigenvector.pyzalgorithms/centrality/katz.pyz%algorithms/centrality/second_order.pyz%algorithms/centrality/subgraph_alg.pyz!algorithms/communicability_alg.pyz$algorithms/link_analysis/hits_alg.pyz(algorithms/link_analysis/pagerank_alg.pyrZ   zalgorithms/similarity.pyconvert_matrix.pyzdrawing/layout.pyz"generators/spectral_graph_forge.pyzlinalg/algebraicconnectivity.pyzlinalg/attrmatrix.pyr[   zlinalg/graphmatrix.pyzlinalg/modularitymatrix.pyzlinalg/spectrum.pyzutils/rcm.pyr\   zdrawing/nx_pylab.pyr]   zdrawing/nx_agraph.pyzdrawing/nx_pydot.pyzalgorithms/polynomials.py)%__doc__r!   r+   r/   importlib.metadatar   r=   r$   r   r4   rF   fixturerO   rX   rS   	has_numpyrU   scipy	has_scipy
matplotlibhas_matplotlibpandas
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_sympyrN   r   r   <module>rv      s   
 
  +  &
>'* & &R  IINJNII 
< ** #$*+ $%*+k!Nk!N&&Nl"N&&Nk!Nk!N [  I  I  N  J  N  I  Is~   C  C" 'C/ .C< 5D	 <D D# CC"C,+C,/C98C9<DD	DDD D #D-,D-