
    h"                        S r SSKrSSKrSSKrSSKJr  SSKrSSKrS rS r	S r
\R                  " SS9S	 5       r\R                  " SS9S
 5       r SSKrSr SSKrSr SSKrSr SSKrSr SSKrSr SSKrSr SSKrSr/ r/ SQr/ SQrSS/r S/r!S/r"S/r#S/r$\(       d  \\-  r\(       d  \\-  r\(       d  \\ -  r\(       d  \\!-  r\(       d  \\"-  r\(       d  \\#-  r\(       d  \\$-  rgg! \ a    Sr Nf = f! \ a    Sr Nf = f! \ a    Sr Nf = f! \ a    Sr Nf = f! \ a    Sr Nf = f! \ a    Sr Nf = f! \ a    Sr Nf = f)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                 p    U R                  SSSSS9  U R                  SSS SS9  U R                  S	SSS
S9  g )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    C/var/www/html/env/lib/python3.13/site-packages/networkx/conftest.pypytest_addoptionr      sc    
L%>N   V	    	      c                    U R                  SS5        U R                  S5      nUc  [        R                  R	                  S5      n[        SSS9nU(       d  [        R                  " S5        Xl        U(       Ga  US   [        R                  R                  R                  S'   0 [        R                  R                  R                  S'   [        R                  R                  " SS[        R                  R                  5       0[        R                  R                  D6[        R                  l        U R                  S	5      nU(       d  [        R                  R	                  S
5      n[        U5      [        R                  l        g g )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networkxutilsbackendsbackend_infoConfigconfigboolfallback_to_nx)r'   r!   loopback_epr)   s       r   pytest_configurer+   ,   s$   
I'GH{+G**..!89M9LMKS	
 N ;Fm:T((7>@,,];#+>>#8#8 $
 --/$
oo&&$
   ))*<=ZZ^^,EFN)-n)=& r   c                    U R                   (       a  U R                   nUS:w  a  S[        R                  R                  R                  l        U/[        R                  R                  l        U/[        R                  R                  l	        [        R                  R                  R                  U   R                  5       n[        US5      (       a  [        US5      " U5        U R                  S5      (       a  g [        R                  R!                  SS9nU H&  nSUR"                  ;   d  M  UR%                  U5        M(     g )Nr"   Ton_start_testsr   zneed --runslow option to run)reasonslow)r!   r"   r#   r$   _dispatchable_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_modifyitemsrA   L   s     ~~ ~~:%@DHNN##11=6B^HOO,,2;G.HOO,,7nn--66|DIIKGw 011!1259$$  (F GIT]]"OOI& r   T)autousec                     [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        S	S9  [         R                  " S[        S
S9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  [         R                  " S[        SS9  g )Nignorez$

single_target_shortest_path_length)categorymessagez

shortest_pathz

The `normalized`z

all_tripletsz

random_triadminimal_d_separatord_separatedz

k_corez	

k_shellz	

k_crustz


k_coronaz

total_spanning_tree_weightz\n\nThe 'create=matrix'z

`compute_v_structureszKeyword argument 'link')r   filterwarningsFutureWarningDeprecationWarningr   r   r   set_warningsrL   e   sm   8
 #
 -7M -7I -7I -7L -} H/A<X-} -} -~ -7W -7Q -7R -7Pr   c                     [         U S'   g )Nnx)r"   )doctest_namespaces    r   add_nxrP      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/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.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   zalgorithms/walks.pyconvert_matrix.pyzdrawing/layout.pydrawing/nx_pylab.pyz"generators/spectral_graph_forge.pyrV   zlinalg/algebraicconnectivity.pyzlinalg/attrmatrix.pyrW   zlinalg/graphmatrix.pyrX   zlinalg/modularitymatrix.pyzlinalg/spectrum.pyzutils/rcm.pyrZ   zgenerators/classic.pyrY   zdrawing/nx_agraph.pyzdrawing/nx_pydot.pyrT   )%__doc__r   sysr   importlib.metadatar   r8   r"   r   r+   rA   fixturerL   rP   numpy	has_numpyImportError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_sympyr   r   r   <module>rv      s    
 
  +  &>@'2 / /d ' 'IINJNII $J *+BC #$*+ $%*+k!Nk!N&&Nl"N&&Nk!Nk!N q  I  I  N  J  N  I  Is~   C3 D !D (D /D+ 6D9 =E 3C>=C>DDDDD('D(+D65D69EEEE