summaryrefslogtreecommitdiff
path: root/networkx/readwrite/tests/test_graphml.py
diff options
context:
space:
mode:
authorjosch <j.schauer@email.de>2020-09-05 19:32:40 +0200
committerGitHub <noreply@github.com>2020-09-05 10:32:40 -0700
commit2bfdee687d0db533555384f92ce3670d47c45aec (patch)
tree893ee18d4855896553ce9f3f2e5dd970bdab6329 /networkx/readwrite/tests/test_graphml.py
parent663b5eb351ac94a6ee39fd47270904f5537c4841 (diff)
downloadnetworkx-2bfdee687d0db533555384f92ce3670d47c45aec.tar.gz
graphml: re-add graph attribute type 'long' after 857aa81 removed it (#4189)
closes: #4188
Diffstat (limited to 'networkx/readwrite/tests/test_graphml.py')
-rw-r--r--networkx/readwrite/tests/test_graphml.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/networkx/readwrite/tests/test_graphml.py b/networkx/readwrite/tests/test_graphml.py
index 7b90791f..fd85d132 100644
--- a/networkx/readwrite/tests/test_graphml.py
+++ b/networkx/readwrite/tests/test_graphml.py
@@ -992,6 +992,29 @@ class TestReadGraphML(BaseGraphML):
for node_data in data:
assert node_data["CustomProperty"] != ""
+ def test_long_attribute_type(self):
+ # test that graphs with attr.type="long" (as produced by botch and
+ # dose3) can be parsed
+ s = """<?xml version='1.0' encoding='utf-8'?>
+<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
+ http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
+ <key attr.name="cudfversion" attr.type="long" for="node" id="d6" />
+ <graph edgedefault="directed">
+ <node id="n1">
+ <data key="d6">4284</data>
+ </node>
+ </graph>
+</graphml>"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ G = nx.read_graphml(fh)
+ expected = [("n1", {"cudfversion": 4284})]
+ assert sorted(G.nodes(data=True)) == expected
+ fh.seek(0)
+ H = nx.parse_graphml(s)
+ assert sorted(H.nodes(data=True)) == expected
+
class TestWriteGraphML(BaseGraphML):
writer = staticmethod(nx.write_graphml_lxml)