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
1d05417a
Commit
1d05417a
authored
Nov 24, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup and marked error handling as 'no coverage'.
parent
7e891018
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
19 deletions
+2
-19
graph.py
graph.py
+1
-18
tests/test_graph.py
tests/test_graph.py
+1
-1
No files found.
graph.py
View file @
1d05417a
...
...
@@ -68,23 +68,6 @@ def generate_graph(root, node_type, separator=' ', verbose=False):
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
):
if
not
isinstance
(
node
,
node_type
):
# 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):
try
:
assert
len
(
title_line
)
==
len
(
edge_line
)
except
AssertionError
:
except
AssertionError
:
# pragma: nocover
print
'------------------'
print
'line_width:'
,
line_width
print
'title_line:'
,
title_line
,
'len:'
,
len
(
title_line
)
...
...
tests/test_graph.py
View file @
1d05417a
...
...
@@ -83,7 +83,7 @@ class TestGraph(unittest.TestCase):
def
assertEqualGraphs
(
self
,
g
,
expect
):
expect
=
self
.
strip
(
expect
)
if
g
!=
expect
:
if
g
!=
expect
:
# pragma: nocover
print
'Expected:'
print
expect
print
'Got:'
...
...
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