From b2bbdb3044c10c6b135c57d5e8ad12694540207b Mon Sep 17 00:00:00 2001 From: Vanshika Mishra <74042272+vanshika230@users.noreply.github.com> Date: Tue, 2 May 2023 21:16:27 +0530 Subject: Improve Test Coverage for current_flow_closeness.py (#6677) Improve_test_coverage_cfc.py --- networkx/algorithms/centrality/tests/test_current_flow_closeness.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'networkx') diff --git a/networkx/algorithms/centrality/tests/test_current_flow_closeness.py b/networkx/algorithms/centrality/tests/test_current_flow_closeness.py index 24a916a4..2528d622 100644 --- a/networkx/algorithms/centrality/tests/test_current_flow_closeness.py +++ b/networkx/algorithms/centrality/tests/test_current_flow_closeness.py @@ -32,6 +32,12 @@ class TestFlowClosenessCentrality: for n in sorted(G): assert b[n] == pytest.approx(b_answer[n], abs=1e-7) + def test_current_flow_closeness_centrality_not_connected(self): + G = nx.Graph() + G.add_nodes_from([1, 2, 3]) + with pytest.raises(nx.NetworkXError): + nx.current_flow_closeness_centrality(G) + class TestWeightedFlowClosenessCentrality: pass -- cgit v1.2.1