summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOkite chimaobi Samuel <okitesamuel@gmail.com>2022-10-20 19:57:36 +0100
committerJarrod Millman <jarrod.millman@gmail.com>2022-11-01 10:27:51 -0700
commitafcfbf5534f354afcff8e82b5990223c01a4a126 (patch)
treedcdeee226eadf791c4542234a4c2608378061eb5
parent5361ef6f06d7f05672b94a8d7912f2c9cc4729af (diff)
downloadnetworkx-afcfbf5534f354afcff8e82b5990223c01a4a126.tar.gz
Improve test coverage for algorithms/richclub.py (#6089)
* improved test coverage for richclub.py * improved test coverage for richclub.py
-rw-r--r--networkx/algorithms/tests/test_richclub.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/networkx/algorithms/tests/test_richclub.py b/networkx/algorithms/tests/test_richclub.py
index 1ed42d45..5638ddbf 100644
--- a/networkx/algorithms/tests/test_richclub.py
+++ b/networkx/algorithms/tests/test_richclub.py
@@ -80,6 +80,17 @@ def test_rich_club_exception2():
nx.rich_club_coefficient(G)
+def test_rich_club_selfloop():
+ G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
+ G.add_edge(1, 1) # self loop
+ G.add_edge(1, 2)
+ with pytest.raises(
+ Exception,
+ match="rich_club_coefficient is not implemented for " "graphs with self loops.",
+ ):
+ nx.rich_club_coefficient(G)
+
+
# def test_richclub2_normalized():
# T = nx.balanced_tree(2,10)
# rcNorm = nx.richclub.rich_club_coefficient(T,Q=2)