diff options
author | Mjh9122 <69970567+Mjh9122@users.noreply.github.com> | 2022-10-31 15:30:15 -0400 |
---|---|---|
committer | Jarrod Millman <jarrod.millman@gmail.com> | 2022-11-01 10:28:55 -0700 |
commit | a130cb6f4c1727b0caf71776f61e557546ff179f (patch) | |
tree | 22694da07e16e674504a725745c09d971d54e57d | |
parent | f215fb0acc64d7ed86178479c4af972bba1f0280 (diff) | |
download | networkx-a130cb6f4c1727b0caf71776f61e557546ff179f.tar.gz |
Increase covering coverage (#6099)
* Added Exception test to test_covering.py
* Completed Testing for covering.py
* Added test and style change
* Update networkx/algorithms/tests/test_covering.py
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Imported pytest, should pass all tests now
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
-rw-r--r-- | networkx/algorithms/tests/test_covering.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/networkx/algorithms/tests/test_covering.py b/networkx/algorithms/tests/test_covering.py index 40971963..b2f97a86 100644 --- a/networkx/algorithms/tests/test_covering.py +++ b/networkx/algorithms/tests/test_covering.py @@ -1,3 +1,5 @@ +import pytest + import networkx as nx @@ -13,6 +15,15 @@ class TestMinEdgeCover: G.add_edge(0, 0) assert nx.min_edge_cover(G) == {(0, 0)} + def test_graph_with_isolated_v(self): + G = nx.Graph() + G.add_node(1) + with pytest.raises( + nx.NetworkXException, + match="Graph has a node with no edge incident on it, so no edge cover exists.", + ): + nx.min_edge_cover(G) + def test_graph_single_edge(self): G = nx.Graph([(0, 1)]) assert nx.min_edge_cover(G) in ({(0, 1)}, {(1, 0)}) |