summaryrefslogtreecommitdiff
path: root/networkx/drawing/tests/test_agraph.py
diff options
context:
space:
mode:
authorJarrod Millman <jarrod.millman@gmail.com>2021-05-26 08:59:54 -0700
committerGitHub <noreply@github.com>2021-05-26 08:59:54 -0700
commit09b30ba69dd2e81a2728fd1259ca7b4d88470827 (patch)
treeec1c723f51473a8ff99fb0195783c607242bb90c /networkx/drawing/tests/test_agraph.py
parent7771b28bad07f0a07ac08ef8c2c6a17191d36f54 (diff)
downloadnetworkx-09b30ba69dd2e81a2728fd1259ca7b4d88470827.tar.gz
Refactor testing utilities (#4829)
* Refactor testing utilities Change `assert_edges_equal`, `assert_graphs_equal`, and `assert_nodes_equal` to be more pytest-idiomatic. For example, `assert_edges_equal` becomes the Boolean function `edges_equal` and then the assert is done the testing file (i.e., `assert edges_equal(edges1, edges2)`). This also makes these utility functions useful in nontesting situations where you want to compare edges, but not raise an exception based on the result. * Move testing utility functions * Use new testing utilities * Deprecate assert_*_equal testing utilities * Document node, edge, and graph equality helper functions * text nits. * Update networkx/tests/test_convert_pandas.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/readwrite/tests/test_sparse6.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/readwrite/tests/test_graph6.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/generators/tests/test_classic.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/tree/tests/test_operations.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/tree/tests/test_coding.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/tests/test_dag.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/minors/tests/test_contraction.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * add short equality description to docstring * Suppress known warnings Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Dan Schult <dschult@colgate.edu>
Diffstat (limited to 'networkx/drawing/tests/test_agraph.py')
-rw-r--r--networkx/drawing/tests/test_agraph.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/networkx/drawing/tests/test_agraph.py b/networkx/drawing/tests/test_agraph.py
index bf91f335..33e77c36 100644
--- a/networkx/drawing/tests/test_agraph.py
+++ b/networkx/drawing/tests/test_agraph.py
@@ -6,7 +6,7 @@ import pytest
pygraphviz = pytest.importorskip("pygraphviz")
-from networkx.testing import assert_edges_equal, assert_nodes_equal, assert_graphs_equal
+from networkx.utils import nodes_equal, edges_equal, graphs_equal
import networkx as nx
@@ -20,8 +20,8 @@ class TestAGraph:
return G
def assert_equal(self, G1, G2):
- assert_nodes_equal(G1.nodes(), G2.nodes())
- assert_edges_equal(G1.edges(), G2.edges())
+ assert nodes_equal(G1.nodes(), G2.nodes())
+ assert edges_equal(G1.edges(), G2.edges())
assert G1.graph["metal"] == G2.graph["metal"]
def agraph_checks(self, G):
@@ -188,21 +188,21 @@ class TestAGraph:
G = nx.Graph()
A = nx.nx_agraph.to_agraph(G)
H = nx.nx_agraph.from_agraph(A)
- # assert_graphs_equal(G, H)
+ # assert graphs_equal(G, H)
AA = nx.nx_agraph.to_agraph(H)
HH = nx.nx_agraph.from_agraph(AA)
- assert_graphs_equal(H, HH)
+ assert graphs_equal(H, HH)
G.graph["graph"] = {}
G.graph["node"] = {}
G.graph["edge"] = {}
- assert_graphs_equal(G, HH)
+ assert graphs_equal(G, HH)
@pytest.mark.xfail(reason="integer->string node conversion in round trip")
def test_round_trip_integer_nodes(self):
G = nx.complete_graph(3)
A = nx.nx_agraph.to_agraph(G)
H = nx.nx_agraph.from_agraph(A)
- assert_graphs_equal(G, H)
+ assert graphs_equal(G, H)
def test_graphviz_alias(self):
G = self.build_graph(nx.Graph())