MCPcopy
hub / github.com/networkx/networkx / test_slice_and_spell

Method test_slice_and_spell

networkx/readwrite/tests/test_gexf.py:576–600  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

574 )
575
576 def test_slice_and_spell(self):
577 # Test spell first, so version = 1.2
578 G = nx.Graph()
579 G.add_node(0, label="1", color="green")
580 G.nodes[0]["spells"] = [(1, 2)]
581 fh = io.BytesIO()
582 nx.write_gexf(G, fh)
583 fh.seek(0)
584 H = nx.read_gexf(fh, node_type=int)
585 assert sorted(G.nodes()) == sorted(H.nodes())
586 assert sorted(sorted(e) for e in G.edges()) == sorted(
587 sorted(e) for e in H.edges()
588 )
589
590 G = nx.Graph()
591 G.add_node(0, label="1", color="green")
592 G.nodes[0]["slices"] = [(1, 2)]
593 fh = io.BytesIO()
594 nx.write_gexf(G, fh, version="1.1draft")
595 fh.seek(0)
596 H = nx.read_gexf(fh, node_type=int)
597 assert sorted(G.nodes()) == sorted(H.nodes())
598 assert sorted(sorted(e) for e in G.edges()) == sorted(
599 sorted(e) for e in H.edges()
600 )
601
602 def test_add_parent(self):
603 G = nx.Graph()

Callers

nothing calls this directly

Calls 3

add_nodeMethod · 0.95
nodesMethod · 0.95
edgesMethod · 0.95

Tested by

no test coverage detected