Added test cases for raise_numerics.

parent c03390ba
from src.rules.numerics import match_add_numerics, add_numerics, \
match_divide_numerics, divide_numerics, match_multiply_numerics, \
multiply_numerics
multiply_numerics, raise_numerics
from src.node import ExpressionLeaf as L, Scope
from src.possibilities import Possibility as P
from tests.rulestestcase import RulesTestCase, tree
......@@ -131,3 +131,13 @@ class TestRulesNumerics(RulesTestCase):
l5_neg, l6 = mul
self.assertEqualNodes(multiply_numerics(mul, (Scope(mul),
l5_neg, l6)), -l30)
def test_raise_numerics(self):
l1, l2 = root = tree('2 ^ 3')
self.assertEqualNodes(raise_numerics(root, (l1, l2)), L(8))
l1_neg, l2 = root = tree('(-2) ^ 2')
self.assertEqualNodes(raise_numerics(root, (l1_neg, l2)), --L(4))
l1_neg, l2 = root = tree('(-2) ^ 3')
self.assertEqualNodes(raise_numerics(root, (l1_neg, l2)), ---L(8))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment