summaryrefslogtreecommitdiff
path: root/networkx/algorithms/assortativity/tests/base_test.py
diff options
context:
space:
mode:
authorAric Hagberg <aric.hagberg@gmail.com>2011-10-02 10:05:58 -0600
committerAric Hagberg <aric.hagberg@gmail.com>2011-10-02 10:05:58 -0600
commit4274d6966b89917efd983ad88c105447e2efacb1 (patch)
treea2952399f7f62b8442fc763a1f2bd17584824c50 /networkx/algorithms/assortativity/tests/base_test.py
parentd2e03fca6b9e8e06cefb0c6925da8946d30c98cb (diff)
downloadnetworkx-4274d6966b89917efd983ad88c105447e2efacb1.tar.gz
Refactor tests for assortativity. Addresses #640 and #639
--HG-- rename : networkx/algorithms/assortativity/tests/test_mixing_attributes.py => networkx/algorithms/assortativity/tests/test_pairs.py
Diffstat (limited to 'networkx/algorithms/assortativity/tests/base_test.py')
-rw-r--r--networkx/algorithms/assortativity/tests/base_test.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/networkx/algorithms/assortativity/tests/base_test.py b/networkx/algorithms/assortativity/tests/base_test.py
new file mode 100644
index 00000000..2e165441
--- /dev/null
+++ b/networkx/algorithms/assortativity/tests/base_test.py
@@ -0,0 +1,50 @@
+import networkx as nx
+
+class BaseTestAttributeMixing(object):
+
+ def setUp(self):
+ G=nx.Graph()
+ G.add_nodes_from([0,1],fish='one')
+ G.add_nodes_from([2,3],fish='two')
+ G.add_nodes_from([4],fish='red')
+ G.add_nodes_from([5],fish='blue')
+ G.add_edges_from([(0,1),(2,3),(0,4),(2,5)])
+ self.G=G
+
+ D=nx.DiGraph()
+ D.add_nodes_from([0,1],fish='one')
+ D.add_nodes_from([2,3],fish='two')
+ D.add_nodes_from([4],fish='red')
+ D.add_nodes_from([5],fish='blue')
+ D.add_edges_from([(0,1),(2,3),(0,4),(2,5)])
+ self.D=D
+
+ M=nx.MultiGraph()
+ M.add_nodes_from([0,1],fish='one')
+ M.add_nodes_from([2,3],fish='two')
+ M.add_nodes_from([4],fish='red')
+ M.add_nodes_from([5],fish='blue')
+ M.add_edges_from([(0,1),(0,1),(2,3)])
+ self.M=M
+
+ S=nx.Graph()
+ S.add_nodes_from([0,1],fish='one')
+ S.add_nodes_from([2,3],fish='two')
+ S.add_nodes_from([4],fish='red')
+ S.add_nodes_from([5],fish='blue')
+ S.add_edge(0,0)
+ S.add_edge(2,2)
+ self.S=S
+
+class BaseTestDegreeMixing(object):
+
+ def setUp(self):
+ self.P4=nx.path_graph(4)
+ self.D=nx.DiGraph()
+ self.D.add_edges_from([(0, 2), (0, 3), (1, 3), (2, 3)])
+ self.M=nx.MultiGraph()
+ self.M.add_path(list(range(4)))
+ self.M.add_edge(0,1)
+ self.S=nx.Graph()
+ self.S.add_edges_from([(0,0),(1,1)])
+