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
17d69216
Commit
17d69216
authored
Feb 20, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for maximum code coverage in powers rules.
parent
05c35766
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
src/rules/powers.py
src/rules/powers.py
+1
-1
tests/test_rules_powers.py
tests/test_rules_powers.py
+8
-0
No files found.
src/rules/powers.py
View file @
17d69216
...
@@ -27,7 +27,7 @@ def match_add_exponents(node):
...
@@ -27,7 +27,7 @@ def match_add_exponents(node):
# Order powers by their roots, e.g. a^p and a^q are put in the same
# Order powers by their roots, e.g. a^p and a^q are put in the same
# list because of the mutual 'a'
# list because of the mutual 'a'
s
,
exponent
=
n
s
,
exponent
=
n
else
:
else
:
# pragma: nocover
continue
continue
s_str
=
str
(
s
)
s_str
=
str
(
s
)
...
...
tests/test_rules_powers.py
View file @
17d69216
...
@@ -39,6 +39,14 @@ class TestRulesPowers(RulesTestCase):
...
@@ -39,6 +39,14 @@ class TestRulesPowers(RulesTestCase):
[
P
(
root
,
add_exponents
,
(
Scope
(
root
),
a0
,
a1
,
a
,
p
,
q
)),
[
P
(
root
,
add_exponents
,
(
Scope
(
root
),
a0
,
a1
,
a
,
p
,
q
)),
P
(
root
,
add_exponents
,
(
Scope
(
root
),
b0
,
b1
,
b
,
p
,
q
))])
P
(
root
,
add_exponents
,
(
Scope
(
root
),
b0
,
b1
,
b
,
p
,
q
))])
def
test_match_add_exponents_nary_multiplication
(
self
):
a
,
p
,
q
=
tree
(
'a,p,q'
)
(
n0
,
l1
),
n1
=
root
=
a
**
p
*
2
*
a
**
q
possibilities
=
match_add_exponents
(
root
)
self
.
assertEqualPos
(
possibilities
,
[
P
(
root
,
add_exponents
,
(
Scope
(
root
),
n0
,
n1
,
a
,
p
,
q
))])
def
test_match_subtract_exponents_powers
(
self
):
def
test_match_subtract_exponents_powers
(
self
):
a
,
p
,
q
=
tree
(
'a,p,q'
)
a
,
p
,
q
=
tree
(
'a,p,q'
)
root
=
a
**
p
/
a
**
q
root
=
a
**
p
/
a
**
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