44 self.assertEquals(
'same', g.get_rank())
45 self.assertEquals(
'digraph', g.get_graph_type())
50 fac.add_node_to_graph(g,
'foo')
51 self.assertEqual(1, len(g.get_nodes()))
52 self.assertEqual(
'foo', g.get_nodes()[0].get_name())
53 self.assertEqual(
'foo', g.get_nodes()[0].get_label())
58 fac.add_node_to_graph(g,
'graph')
59 self.assertEqual(1, len(g.get_nodes()))
60 self.assertEqual(
'graph_', g.get_nodes()[0].get_name())
61 self.assertEqual(
'graph_', g.get_nodes()[0].get_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.get_nodes()))
70 self.assertEqual(1, len(g.get_edges()))
71 self.assertEqual(
'foo', g.get_edges()[0].get_source())
72 self.assertEqual(
'bar', g.get_edges()[0].get_destination())
77 fac.add_subgraph_to_graph(g,
'foo')
78 self.assertEqual(1, len(g.get_subgraph_list()))
79 self.assertEqual(
'cluster_foo', g.get_subgraph_list()[0].get_name())
80 self.assertEqual(
'foo', g.get_subgraph_list()[0].get_label())
85 fac.add_subgraph_to_graph(g,
'graph')
86 self.assertEqual(1, len(g.get_subgraph_list()))
87 self.assertEqual(
'cluster_graph_', g.get_subgraph_list()[0].get_name())
88 self.assertEqual(
'graph_', g.get_subgraph_list()[0].get_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,
'foo')
97 snippets = [
'digraph graphname { graph [',
101 'node [label="\\N"]',
102 'subgraph cluster_foo { graph [',
111 result = fac.create_dot(g)
113 result = re.sub(
'[\n\t ]+',
' ', result)
115 self.assertTrue(sn
in result,
'%s \nmissing in\n %s' % (sn, result))
def test_add_subgraph_escape_name(self)
def test_add_node_escape_name(self)
def test_add_subgraph(self)
def test_create_dot(self)