Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
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
trs
Commits
f51ea5e3
Commit
f51ea5e3
authored
Feb 16, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applied pep8 to unit tests.
parent
c7a9125f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
14 deletions
+11
-14
tests/rulestestcase.py
tests/rulestestcase.py
+2
-2
tests/test_calc.py
tests/test_calc.py
+2
-2
tests/test_exception.py
tests/test_exception.py
+1
-6
tests/test_rules_numerics.py
tests/test_rules_numerics.py
+4
-3
tests/test_rules_powers.py
tests/test_rules_powers.py
+2
-1
No files found.
tests/rulestestcase.py
View file @
f51ea5e3
...
...
@@ -44,10 +44,10 @@ class RulesTestCase(unittest.TestCase):
try
:
for
i
,
exp
in
enumerate
(
rewrite_chain
[:
-
1
]):
self
.
assertMultiLineEqual
(
str
(
rewrite
(
exp
)),
str
(
rewrite_chain
[
i
+
1
]))
str
(
rewrite_chain
[
i
+
1
]))
except
AssertionError
:
# pragma: nocover
print
'rewrite failed: "%s" -> "%s"'
\
%
(
str
(
exp
),
str
(
rewrite_chain
[
i
+
1
]))
%
(
str
(
exp
),
str
(
rewrite_chain
[
i
+
1
]))
print
'rewrite chain index: %d'
%
i
print
'rewrite chain: ---'
...
...
tests/test_calc.py
View file @
f51ea5e3
...
...
@@ -12,11 +12,11 @@ class TestCalc(unittest.TestCase):
==
N
(
'+'
,
L
(
1
),
L
(
4
))
def
test_basic_on_exp
(
self
):
expressions
=
[(
'4'
,
L
(
4
)),
expressions
=
[(
'4'
,
L
(
4
)),
(
'3+4'
,
L
(
3
)
+
L
(
4
)),
(
'3-4'
,
L
(
3
)
+
-
L
(
4
)),
(
'3/4'
,
L
(
3
)
/
L
(
4
)),
(
'-4'
,
-
L
(
4
)),
(
'-4'
,
-
L
(
4
)),
(
'3^4'
,
N
(
'^'
,
L
(
3
),
L
(
4
))),
(
'(2)'
,
L
(
2
))]
...
...
tests/test_exception.py
View file @
f51ea5e3
...
...
@@ -7,9 +7,4 @@ from tests.parser import ParserWrapper
class
TestException
(
unittest
.
TestCase
):
def
test_raise
(
self
):
try
:
ParserWrapper
(
Parser
).
run
([
'raise'
])
except
RuntimeError
:
return
raise
AssertionError
(
'Expected raised RuntimeError!'
)
# pragma: nocover
self
.
assertRaises
(
RuntimeError
,
ParserWrapper
(
Parser
).
run
,
[
'raise'
])
tests/test_rules_numerics.py
View file @
f51ea5e3
...
...
@@ -93,12 +93,13 @@ class TestRulesNumerics(RulesTestCase):
self
.
assertEqual
(
multiply_numerics
(
i3
*
f2
,
(
i3
,
f2
,
3
,
2.0
)),
6.0
)
self
.
assertEqual
(
multiply_numerics
(
f3
*
f2
,
(
f3
,
f2
,
3.0
,
2.0
)),
6.0
)
self
.
assertEqualNodes
(
multiply_numerics
(
a
*
i3
*
i2
*
b
,
(
i3
,
i2
,
3
,
2
)),
a
*
6
*
b
)
self
.
assertEqualNodes
(
multiply_numerics
(
a
*
i3
*
i2
*
b
,
(
i3
,
i2
,
3
,
2
)),
a
*
6
*
b
)
def
test_multiply_numerics_negation
(
self
):
l1_neg
,
l2
=
root
=
tree
(
'-1 * 2'
)
self
.
assertEqualNodes
(
multiply_numerics
(
root
,
(
l1_neg
,
l2
,
-
1
,
2
)),
-
l2
)
self
.
assertEqualNodes
(
multiply_numerics
(
root
,
(
l1_neg
,
l2
,
-
1
,
2
)),
-
l2
)
root
,
l6
=
tree
(
'1 - 2 * 3,6'
)
l1
,
neg
=
root
...
...
tests/test_rules_powers.py
View file @
f51ea5e3
...
...
@@ -103,7 +103,8 @@ class TestRulesPowers(RulesTestCase):
a
,
p
,
q
=
tree
(
'a,p,q'
)
n0
,
n1
=
root
=
a
**
p
*
a
**
q
self
.
assertEqualNodes
(
add_exponents
(
root
,
(
n0
,
n1
,
a
,
p
,
q
)),
a
**
(
p
+
q
))
self
.
assertEqualNodes
(
add_exponents
(
root
,
(
n0
,
n1
,
a
,
p
,
q
)),
a
**
(
p
+
q
))
def
test_subtract_exponents
(
self
):
a
,
p
,
q
=
tree
(
'a,p,q'
)
...
...
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