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
122476b1
Commit
122476b1
authored
Feb 16, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added negation to node stringification.
parent
b3cbdd4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
node.py
node.py
+3
-2
tests/test_node.py
tests/test_node.py
+8
-0
No files found.
node.py
View file @
122476b1
...
...
@@ -32,7 +32,8 @@ class Node(object):
return
copy
def
__str__
(
self
):
return
'<Node value=%s nodes=%s>'
%
(
str
(
self
.
value
),
str
(
self
.
nodes
))
return
'<Node value=%s nodes=%s negated=%d>'
\
%
(
str
(
self
.
value
),
str
(
self
.
nodes
),
self
.
negated
)
def
title
(
self
):
return
str
(
self
.
value
)
...
...
@@ -52,4 +53,4 @@ class Leaf(Node):
return
repr
(
self
.
value
)
def
__str__
(
self
):
return
str
(
self
.
value
)
return
'-'
*
self
.
negated
+
str
(
self
.
value
)
tests/test_node.py
View file @
122476b1
...
...
@@ -34,3 +34,11 @@ class TestNode(unittest.TestCase):
def
test_title
(
self
):
assert
self
.
node
.
title
()
==
'node'
assert
self
.
l0
.
title
()
==
'leaf 1'
def
test____str__
(
self
):
l1
=
Leaf
(
1
)
self
.
assertEqual
(
str
(
l1
),
'1'
)
l1
=
-
l1
self
.
assertEqual
(
str
(
l1
),
'-1'
)
l1
=
-
l1
self
.
assertEqual
(
str
(
l1
),
'--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