Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
graph_drawing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
graph_drawing
Commits
8349bc37
Commit
8349bc37
authored
12 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Added FIXME for long node titles.
parent
39cde146
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
graph.py
+2
-2
2 additions, 2 deletions
graph.py
tests/test_graph.py
+23
-0
23 additions, 0 deletions
tests/test_graph.py
with
25 additions
and
2 deletions
graph.py
+
2
−
2
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
...
...
This diff is collapsed.
Click to expand it.
tests/test_graph.py
+
23
−
0
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
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment