Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
graph_drawing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
graph_drawing
Commits
8349bc37
Commit
8349bc37
authored
Sep 13, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added FIXME for long node titles.
parent
39cde146
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
graph.py
graph.py
+2
-2
tests/test_graph.py
tests/test_graph.py
+23
-0
No files found.
graph.py
View file @
8349bc37
...
...
@@ -183,7 +183,7 @@ def generate_graph(root, separator=' ', verbose=False):
try
:
assert
len
(
title_line
)
==
len
(
edge_line
)
except
AssertionError
:
# pragma: nocover
except
AssertionError
as
e
:
# pragma: nocover
print
'------------------'
print
'line_width:'
,
line_width
print
'title_line:'
,
title_line
,
'len:'
,
len
(
title_line
)
...
...
@@ -191,7 +191,7 @@ def generate_graph(root, separator=' ', verbose=False):
len
(
edge_line
))
print
'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.
return
[
title_line
,
edge_line
]
+
result
...
...
tests/test_graph.py
View file @
8349bc37
...
...
@@ -175,6 +175,29 @@ class TestGraph(unittest.TestCase):
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
):
return
s
.
replace
(
'
\
n
'
,
'
\
n
'
)[
1
:
-
1
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment