This repository has been archived on 2023-03-25. You can view files and clone it, but cannot push or open issues or pull requests.
mightyscape-1.1-deprecated/extensions/networkx/algorithms/tests/test_smetric.py
2020-07-30 01:16:18 +02:00

21 lines
424 B
Python

import pytest
import networkx as nx
def test_smetric():
g = nx.Graph()
g.add_edge(1, 2)
g.add_edge(2, 3)
g.add_edge(2, 4)
g.add_edge(1, 4)
sm = nx.s_metric(g, normalized=False)
assert sm == 19.0
# smNorm = nx.s_metric(g,normalized=True)
# assert_equal(smNorm, 0.95)
def test_normalized():
with pytest.raises(nx.NetworkXError):
sm = nx.s_metric(nx.Graph(), normalized=True)