ó žÃÒYc@ sdZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm Z d e fd „ƒYZ d S( s<Unit tests for the :mod:`networkx.algorithms.wiener` module.iÿÿÿÿ(tdivision(teq_(tcomplete_graph(tDiGraph(t empty_graph(t path_graph(t wiener_indextTestWienerIndexcB s2eZdZd„Zd„Zd„Zd„ZRS(s5Unit tests for computing the Wiener index of a graph.cC s#tttdƒƒtdƒƒdS(s[Tests that the Wiener index of a disconnected graph is positive infinity. itinfN(RRRtfloat(tself((s{/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/tests/test_wiener.pyttest_disconnected_graphscC s9tdƒ}t|ƒ}tdt|ƒt|ƒƒdS(svTests that each pair of nodes in the directed graph is counted once when computing the Wiener index. iiN(RRRR(R tGtH((s{/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/tests/test_wiener.pyt test_directeds  cC s5d}t|ƒ}tt|ƒ||ddƒdS(sbTests that the Wiener index of the complete graph is simply the number of edges. i iiN(RRR(R tnR ((s{/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/tests/test_wiener.pyttest_complete_graph(s c s`d‰tˆƒ}dt‡fd†tdˆddƒDƒƒ}t|ƒ}t||ƒdS(sVTests that the Wiener index of the path graph is correctly computed. i ic3 s|]}|ˆ|VqdS(N((t.0ti(R(s{/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/tests/test_wiener.pys NsiN(RtsumtrangeRR(R R texpectedtactual((Rs{/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/tests/test_wiener.pyttest_path_graph1s  1 (t__name__t __module__t__doc__R RRR(((s{/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/tests/test_wiener.pyRs   N( Rt __future__Rt nose.toolsRtnetworkxRRRRRtobjectR(((s{/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/tests/test_wiener.pyt s