summaryrefslogtreecommitdiff
path: root/networkx/drawing/tests/test_agraph.py
diff options
context:
space:
mode:
authorNavya Agarwal <82928853+navyagarwal@users.noreply.github.com>2023-04-07 06:37:04 +0530
committerGitHub <noreply@github.com>2023-04-06 18:07:04 -0700
commitd4e2331db1121c96b5fd09793b28c2e6a9cd03c2 (patch)
treef6b19e83335bacfa90822d153300abb35f147428 /networkx/drawing/tests/test_agraph.py
parent32f8a6c3c14dc9f81eaf7076e71ef58417c42d78 (diff)
downloadnetworkx-d4e2331db1121c96b5fd09793b28c2e6a9cd03c2.tar.gz
Fix handling of pos node attribute in to_agraph (#6474)
Make sure the `"pos"` node attribute is properly formatted for pygraphviz, if present.
Diffstat (limited to 'networkx/drawing/tests/test_agraph.py')
-rw-r--r--networkx/drawing/tests/test_agraph.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/networkx/drawing/tests/test_agraph.py b/networkx/drawing/tests/test_agraph.py
index c99d29fb..1ade719b 100644
--- a/networkx/drawing/tests/test_agraph.py
+++ b/networkx/drawing/tests/test_agraph.py
@@ -240,3 +240,15 @@ class TestAGraph:
pos = list(pos.values())
assert len(pos) == 5
assert len(pos[0]) == 3
+
+ def test_no_warnings_raised(self):
+ # Test that no warnings are raised when Networkx graph
+ # is converted to Pygraphviz graph and 'pos'
+ # attribute is given
+ G = nx.Graph()
+ G.add_node(0, pos=(0, 0))
+ G.add_node(1, pos=(1, 1))
+ A = nx.nx_agraph.to_agraph(G)
+ with pytest.warns(None) as record:
+ A.layout()
+ assert len(record) == 0