44 self.assertEquals(
'same', g.graph_attr[
'rank'])
45 self.assertTrue(g.is_directed())
50 fac.add_node_to_graph(g,
'foo')
51 self.assertEqual(1, len(g.nodes()))
52 self.assertEqual(
'foo', g.nodes()[0].get_name())
53 self.assertEqual(
'foo', g.nodes()[0].attr[
'label'])
58 fac.add_node_to_graph(g,
'graph')
59 self.assertEqual(1, len(g.nodes()))
60 self.assertEqual(
'graph', g.nodes()[0].get_name())
61 self.assertEqual(
'graph', g.nodes()[0].attr[
'label'])
66 fac.add_node_to_graph(g,
'foo')
67 fac.add_node_to_graph(g,
'bar')
68 fac.add_edge_to_graph(g,
'foo',
'bar')
69 self.assertEqual(2, len(g.nodes()))
70 self.assertEqual(1, len(g.edges()))
71 self.assertEqual(
'foo', g.edges()[0][0])
72 self.assertEqual(
'bar', g.edges()[0][1])
77 fac.add_subgraph_to_graph(g,
'foo')
78 self.assertEqual(1, len(g.subgraphs()))
79 self.assertEqual(
'cluster_foo', g.subgraphs()[0].get_name())
80 self.assertEqual(
'foo', g.subgraphs()[0].graph_attr[
'label'])
85 fac.add_subgraph_to_graph(g,
'graph')
86 self.assertEqual(1, len(g.subgraphs()))
87 self.assertEqual(
'cluster_graph', g.subgraphs()[0].get_name())
88 self.assertEqual(
'graph', g.subgraphs()[0].graph_attr[
'label'])
93 fac.add_node_to_graph(g,
'foo')
94 fac.add_node_to_graph(g,
'edge')
95 fac.add_edge_to_graph(g,
'foo',
'edge')
96 fac.add_subgraph_to_graph(g,
'graph')
97 snippets = [
'strict digraph { graph',
103 result = fac.create_dot(g)
105 result = re.sub(
'""',
' ', result)
106 result = re.sub(
'[\n\t ]+',
' ', result)
108 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)