Commit 8349bc37 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added FIXME for long node titles.

parent 39cde146
...@@ -183,7 +183,7 @@ def generate_graph(root, separator=' ', verbose=False): ...@@ -183,7 +183,7 @@ def generate_graph(root, separator=' ', verbose=False):
try: try:
assert len(title_line) == len(edge_line) assert len(title_line) == len(edge_line)
except AssertionError: # pragma: nocover except AssertionError as e: # 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)
...@@ -191,7 +191,7 @@ def generate_graph(root, separator=' ', verbose=False): ...@@ -191,7 +191,7 @@ def generate_graph(root, separator=' ', verbose=False):
len(edge_line)) len(edge_line))
print 'lines:' print 'lines:'
print '\n'.join(map(lambda x: x + ' %d' % len(x), lines)) print '\n'.join(map(lambda x: x + ' %d' % len(x), lines))
raise Exception() raise e
# Add the line of this node before all child lines. # Add the line of this node before all child lines.
return [title_line, edge_line] + result return [title_line, edge_line] + result
......
...@@ -175,6 +175,29 @@ class TestGraph(unittest.TestCase): ...@@ -175,6 +175,29 @@ class TestGraph(unittest.TestCase):
3 5 3 7 3 5 3 7
""") """)
def test_long_node_title(self):
x = Leaf('x')
p = Node('^', x, Leaf(2))
root = Node('sin', p)
self.assertEqualGraphs(generate_graph(root), """
sin
^
╭┴╮
x 2
""")
# FIXME: p[0] = Node('cos', x)
# FIXME: self.assertEqualGraphs(generate_graph(root), """
# FIXME: sin
# FIXME: │
# FIXME: ^
# FIXME: ╭─┴╮
# FIXME: cos 2
# FIXME: │
# FIXME: x
# FIXME: """)
def strip(self, s): def strip(self, s):
return s.replace('\n ', '\n')[1:-1] return s.replace('\n ', '\n')[1:-1]
......
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