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
bb3c5d23
Commit
bb3c5d23
authored
Feb 28, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed fraction division line generator.
parent
7f65d03d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
line.py
line.py
+1
-1
tests/test_line.py
tests/test_line.py
+7
-0
No files found.
line.py
View file @
bb3c5d23
...
...
@@ -143,7 +143,7 @@ def generate_line(root):
elif
child_pred
<
node_pred
:
exp
=
'('
+
exp
+
')'
elif
child_pred
==
node_pred
:
if
i
and
(
op
!=
child
.
title
()
\
if
i
and
(
op
!=
child
.
title
()
or
op
==
'/'
\
or
(
op
==
'+'
and
child
[
1
].
negated
)):
exp
=
'('
+
exp
+
')'
elif
not
i
and
op
==
'^'
:
...
...
tests/test_line.py
View file @
bb3c5d23
...
...
@@ -221,3 +221,10 @@ class TestLine(unittest.TestCase):
def
test_double_negation
(
self
):
neg
=
--
L
(
1
)
self
.
assertEquals
(
generate_line
(
neg
),
'--1'
)
def
test_divide_fractions
(
self
):
a
,
b
,
c
,
d
=
L
(
'a'
),
L
(
'b'
),
L
(
'c'
),
L
(
'd'
)
div
=
N
(
'/'
,
a
,
N
(
'/'
,
b
,
c
))
self
.
assertEquals
(
generate_line
(
div
),
'a / (b / c)'
)
div
=
N
(
'/'
,
N
(
'/'
,
a
,
b
),
N
(
'/'
,
c
,
d
))
self
.
assertEquals
(
generate_line
(
div
),
'a / b / (c / d)'
)
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