summaryrefslogtreecommitdiff
path: root/networkx/relabel.py
diff options
context:
space:
mode:
authorAric Hagberg <aric.hagberg@gmail.com>2012-07-08 10:09:17 -0600
committerAric Hagberg <aric.hagberg@gmail.com>2012-07-08 10:09:17 -0600
commitb094906673e9fa5c941aaea5f4e8e005253c9d8b (patch)
tree3f893a932c79a77e8842af1c357496a5060bd360 /networkx/relabel.py
parent8bf2b8aac8b8da923cf994575624f24cc3b63ec1 (diff)
downloadnetworkx-b094906673e9fa5c941aaea5f4e8e005253c9d8b.tar.gz
Fix/adjust/remove/modify tests that depend on dictionary ordering.
Addresses #741 There may still be more that need fixing since 1) NumPy and some other optional packages do not yet work with Python3.3 so those tests weren't checked 2) Finding these errors by running the tests is nondeterministic itself (e.g. passes 4 times and fails on the 5th). And inspecting all of the tests by hand is error-prone too.
Diffstat (limited to 'networkx/relabel.py')
-rw-r--r--networkx/relabel.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/networkx/relabel.py b/networkx/relabel.py
index 10830371..6055c1f1 100644
--- a/networkx/relabel.py
+++ b/networkx/relabel.py
@@ -30,8 +30,8 @@ def relabel_nodes(G, mapping, copy=True):
>>> G=nx.path_graph(3) # nodes 0-1-2
>>> mapping={0:'a',1:'b',2:'c'}
>>> H=nx.relabel_nodes(G,mapping)
- >>> print(H.nodes())
- ['a', 'c', 'b']
+ >>> print(sorted(H.nodes()))
+ ['a', 'b', 'c']
>>> G=nx.path_graph(26) # nodes 0..25
>>> mapping=dict(zip(G.nodes(),"abcdefghijklmnopqrstuvwxyz"))
@@ -44,7 +44,8 @@ def relabel_nodes(G, mapping, copy=True):
>>> G=nx.path_graph(3) # nodes 0-1-2
>>> mapping={0:'a',1:'b'} # 0->'a' and 1->'b'
>>> G=nx.relabel_nodes(G,mapping, copy=False)
- >>> print(G.nodes())
+
+ print(G.nodes())
[2, 'b', 'a']
Mapping as function: