Code cleanup and marked error handling as 'no coverage'.

parent 7e891018
...@@ -68,23 +68,6 @@ def generate_graph(root, node_type, separator=' ', verbose=False): ...@@ -68,23 +68,6 @@ def generate_graph(root, node_type, separator=' ', verbose=False):
return width return width
def node_middle(node):
node_len = len(node)
node_mid = int(node_len / 2)
#if node_len % 2 == 1:
# node_mid += 1
middle = 0
for i, child in enumerate(node):
if i == node_mid:
break
middle += node_width[child]
return middle + max(0, separator_len * (node_mid - 1))
def format_lines(node): def format_lines(node):
if not isinstance(node, node_type): if not isinstance(node, node_type):
# Leaf titles do not need to be centered, since the parent will # Leaf titles do not need to be centered, since the parent will
...@@ -185,7 +168,7 @@ def generate_graph(root, node_type, separator=' ', verbose=False): ...@@ -185,7 +168,7 @@ def generate_graph(root, node_type, separator=' ', verbose=False):
try: try:
assert len(title_line) == len(edge_line) assert len(title_line) == len(edge_line)
except AssertionError: except AssertionError: # pragma: nocover
print '------------------' print '------------------'
print 'line_width:', line_width print 'line_width:', line_width
print 'title_line:', title_line, 'len:', len(title_line) print 'title_line:', title_line, 'len:', len(title_line)
......
...@@ -83,7 +83,7 @@ class TestGraph(unittest.TestCase): ...@@ -83,7 +83,7 @@ class TestGraph(unittest.TestCase):
def assertEqualGraphs(self, g, expect): def assertEqualGraphs(self, g, expect):
expect = self.strip(expect) expect = self.strip(expect)
if g != expect: if g != expect: # pragma: nocover
print 'Expected:' print 'Expected:'
print expect print expect
print 'Got:' print 'Got:'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment