summaryrefslogtreecommitdiff
path: root/networkx/readwrite/json_graph/tests
diff options
context:
space:
mode:
authorDan Schult <dschult@colgate.edu>2017-08-12 17:20:15 -0600
committerGitHub <noreply@github.com>2017-08-12 17:20:15 -0600
commit2c6740efbebf56fc28686bc01c49f541f307d353 (patch)
tree5c6db5caf25b2dddfa4e0d3df4e35e1bd67d859e /networkx/readwrite/json_graph/tests
parentd72aca7a92c7de6d854e50ec4dc7235842780490 (diff)
downloadnetworkx-2c6740efbebf56fc28686bc01c49f541f307d353.tar.gz
Simplify base classes. (#2604)
* move selfloop methods out of graph classes into function.py * replace G.node with G.nodes. fix Pickle of views * Replace G.edge with G.edges * Add a few lines of docs for release realted to this PR.
Diffstat (limited to 'networkx/readwrite/json_graph/tests')
-rw-r--r--networkx/readwrite/json_graph/tests/test_adjacency.py4
-rw-r--r--networkx/readwrite/json_graph/tests/test_cytoscape.py12
-rw-r--r--networkx/readwrite/json_graph/tests/test_node_link.py10
-rw-r--r--networkx/readwrite/json_graph/tests/test_tree.py4
4 files changed, 15 insertions, 15 deletions
diff --git a/networkx/readwrite/json_graph/tests/test_adjacency.py b/networkx/readwrite/json_graph/tests/test_adjacency.py
index 06b36830..ca19423b 100644
--- a/networkx/readwrite/json_graph/tests/test_adjacency.py
+++ b/networkx/readwrite/json_graph/tests/test_adjacency.py
@@ -19,14 +19,14 @@ class TestAdjacency:
H = adjacency_graph(adjacency_data(G))
assert_equal(H.graph['foo'],'bar')
- assert_equal(H.node[1]['color'],'red')
+ assert_equal(H.nodes[1]['color'],'red')
assert_equal(H[1][2]['width'],7)
d = json.dumps(adjacency_data(G))
H = adjacency_graph(json.loads(d))
assert_equal(H.graph['foo'],'bar')
assert_equal(H.graph[1],'one')
- assert_equal(H.node[1]['color'],'red')
+ assert_equal(H.nodes[1]['color'],'red')
assert_equal(H[1][2]['width'],7)
def test_digraph(self):
diff --git a/networkx/readwrite/json_graph/tests/test_cytoscape.py b/networkx/readwrite/json_graph/tests/test_cytoscape.py
index 6907071c..639f87e1 100644
--- a/networkx/readwrite/json_graph/tests/test_cytoscape.py
+++ b/networkx/readwrite/json_graph/tests/test_cytoscape.py
@@ -20,20 +20,20 @@ class TestCytoscape:
H = cytoscape_graph(cytoscape_data(G))
assert_equal(H.graph['foo'],'bar')
- assert_equal(H.node[1]['color'],'red')
+ assert_equal(H.nodes[1]['color'],'red')
assert_equal(H[1][2]['width'],7)
- assert_equal(H.node[3]['name'],'node')
- assert_equal(H.node[3]['id'],'123')
+ assert_equal(H.nodes[3]['name'],'node')
+ assert_equal(H.nodes[3]['id'],'123')
d = json.dumps(cytoscape_data(G))
H = cytoscape_graph(json.loads(d))
assert_equal(H.graph['foo'],'bar')
assert_equal(H.graph[1],'one')
- assert_equal(H.node[1]['color'],'red')
+ assert_equal(H.nodes[1]['color'],'red')
assert_equal(H[1][2]['width'],7)
- assert_equal(H.node[3]['name'],'node')
- assert_equal(H.node[3]['id'],'123')
+ assert_equal(H.nodes[3]['name'],'node')
+ assert_equal(H.nodes[3]['id'],'123')
diff --git a/networkx/readwrite/json_graph/tests/test_node_link.py b/networkx/readwrite/json_graph/tests/test_node_link.py
index f1068cf9..870b7e8d 100644
--- a/networkx/readwrite/json_graph/tests/test_node_link.py
+++ b/networkx/readwrite/json_graph/tests/test_node_link.py
@@ -21,14 +21,14 @@ class TestNodeLink:
H = node_link_graph(node_link_data(G))
assert_equal(H.graph['foo'], 'bar')
- assert_equal(H.node[1]['color'], 'red')
+ assert_equal(H.nodes[1]['color'], 'red')
assert_equal(H[1][2]['width'], 7)
d = json.dumps(node_link_data(G))
H = node_link_graph(json.loads(d))
assert_equal(H.graph['foo'], 'bar')
assert_equal(H.graph['1'], 'one')
- assert_equal(H.node[1]['color'], 'red')
+ assert_equal(H.nodes[1]['color'], 'red')
assert_equal(H[1][2]['width'], 7)
def test_digraph(self):
@@ -51,7 +51,7 @@ class TestNodeLink:
dumped_d = json.dumps(d)
dd = json.loads(dumped_d)
H = node_link_graph(dd)
- assert_equal(H.node[(0, 0)], G.node[(0, 0)])
+ assert_equal(H.nodes[(0, 0)], G.nodes[(0, 0)])
assert_equal(H[(0, 0)][(1, 0)]['color'], [255, 255, 0])
def test_unicode_keys(self):
@@ -65,7 +65,7 @@ class TestNodeLink:
output = json.dumps(s, ensure_ascii=False)
data = json.loads(output)
H = node_link_graph(data)
- assert_equal(H.node[1][q], q)
+ assert_equal(H.nodes[1][q], q)
@raises(nx.NetworkXError)
def test_exception(self):
@@ -101,6 +101,6 @@ class TestNodeLink:
H = node_link_graph(node_link_data(G, attrs=attrs), multigraph=False, attrs=attrs)
assert_true(nx.is_isomorphic(G, H))
assert_equal(H.graph['foo'], 'bar')
- assert_equal(H.node[1]['color'], 'red')
+ assert_equal(H.nodes[1]['color'], 'red')
assert_equal(H[1][2]['width'], 7)
diff --git a/networkx/readwrite/json_graph/tests/test_tree.py b/networkx/readwrite/json_graph/tests/test_tree.py
index 659c4d8f..c69a3143 100644
--- a/networkx/readwrite/json_graph/tests/test_tree.py
+++ b/networkx/readwrite/json_graph/tests/test_tree.py
@@ -21,11 +21,11 @@ class TestTree:
G.add_edge(1,3,foo=10)
G.add_edge(3,4,foo=10)
H = tree_graph(tree_data(G,1))
- assert_equal(H.node[1]['color'],'red')
+ assert_equal(H.nodes[1]['color'],'red')
d = json.dumps(tree_data(G,1))
H = tree_graph(json.loads(d))
- assert_equal(H.node[1]['color'],'red')
+ assert_equal(H.nodes[1]['color'],'red')
@raises(nx.NetworkXError)
def test_exception(self):