43 self.assertEquals(
'same', g.graph_attr[
'rank'])
44 self.assertTrue(g.is_directed())
49 fac.add_node_to_graph(g,
'foo')
50 self.assertEqual(1, len(g.nodes()))
51 self.assertEqual(
'foo', g.nodes()[0].get_name())
52 self.assertEqual(
'foo', g.nodes()[0].attr[
'label'])
57 fac.add_node_to_graph(g,
'graph')
58 self.assertEqual(1, len(g.nodes()))
59 self.assertEqual(
'graph', g.nodes()[0].get_name())
60 self.assertEqual(
'graph', g.nodes()[0].attr[
'label'])
65 fac.add_node_to_graph(g,
'foo')
66 fac.add_node_to_graph(g,
'bar')
67 fac.add_edge_to_graph(g,
'foo',
'bar')
68 self.assertEqual(2, len(g.nodes()))
69 self.assertEqual(1, len(g.edges()))
70 self.assertEqual(
'foo', g.edges()[0][0])
71 self.assertEqual(
'bar', g.edges()[0][1])
76 fac.add_subgraph_to_graph(g,
'foo')
77 self.assertEqual(1, len(g.subgraphs()))
78 self.assertEqual(
'cluster_foo', g.subgraphs()[0].get_name())
79 self.assertEqual(
'foo', g.subgraphs()[0].graph_attr[
'label'])
84 fac.add_subgraph_to_graph(g,
'graph')
85 self.assertEqual(1, len(g.subgraphs()))
86 self.assertEqual(
'cluster_graph', g.subgraphs()[0].get_name())
87 self.assertEqual(
'graph', g.subgraphs()[0].graph_attr[
'label'])
92 fac.add_node_to_graph(g,
'foo')
93 fac.add_node_to_graph(g,
'edge')
94 fac.add_edge_to_graph(g,
'foo',
'edge')
95 fac.add_subgraph_to_graph(g,
'graph')
96 snippets = [
'strict digraph {\n\tgraph',
102 result = fac.create_dot(g)
104 self.assertTrue(sn
in result,
'%s \nmissing in\n %s' % (sn, result))
def test_create_dot(self)
def test_add_subgraph(self)
def test_add_node_escape_name(self)
def test_add_subgraph_escape_name(self)