o
    h"                     @   s&  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d Zdd Z	dd	 Z
ejd
ddd Zejd
ddd ZzddlZd
ZW n eyO   dZY nw zddlZd
ZW n eyc   dZY nw zddlZd
ZW n eyw   dZY nw zddlZd
ZW n ey   dZY nw zddlZd
ZW n ey   dZY nw zddlZd
ZW n ey   dZY nw zddlZd
ZW n ey   dZY nw 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see7 Zesee7 Zesee 7 Zesee!7 Zesee"7 Zesee#7 Zesee$7 ZdS dS )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                 C   s:   | j ddddd | j ddd dd | j d	ddd
d d S )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)parser r   e/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/networkx/conftest.pypytest_addoption   s   
r   c                 C   s   |  dd | d}|d u rtjd}tddd}|s"td || _|r^|d t	j
jjd< i t	j
jjd< t	j
jddt	j
 it	jjt	j_| d	}|sVtjd
}t|t	j_d S d S )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_NXr   )addinivalue_line	getoptionosenvirongetr   warningswarnbackendnetworkxutilsbackendsbackend_infoConfigconfigboolfallback_to_nx)r#   r   loopback_epr%   r   r   r   pytest_configure,   s.   



r'   c                 C   s   | j r1| j }|dkr1dtjjj_|gtjj_|gtjj_	tjjj| 
 }t|dr1t|d| | dr8d S tjjdd}|D ]}d|jv rM|| qAd S )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itemr   r   r   pytest_collection_modifyitemsL   s"   



r<   T)autousec                   C   s   t jdtdd t jdtdd t jdtdd t jdtdd t jdtdd t jdtdd t jdtd	d t jdtd
d t jdtdd t jdtdd t jdtdd t jdtdd t jdtdd t jdtdd t jdtdd d S )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   r   set_warningse   s^   
rF   c                 C   s   t | d< d S )Nnx)r   )doctest_namespacer   r   r   add_nx   s   rI   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)#rJ   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.pyrK   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.pyrL   zalgorithms/similarity.pyrN   zalgorithms/walks.pyconvert_matrix.pyzdrawing/layout.pydrawing/nx_pylab.pyz"generators/spectral_graph_forge.pyrO   zlinalg/algebraicconnectivity.pyzlinalg/attrmatrix.pyrP   zlinalg/graphmatrix.pyrQ   zlinalg/modularitymatrix.pyzlinalg/spectrum.pyzutils/rcm.pyrS   zgenerators/classic.pyrR   zdrawing/nx_agraph.pyzdrawing/nx_pydot.pyrM   )%__doc__r   sysr   importlib.metadatar   r3   r   r   r'   r<   fixturerF   rI   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   r   <module>   s     


2
%