| 123456789101112131415161718192021 |
- from src.rules.lineq import match_subtract_addition_term, \
- subtract_addition_term
- from src.node import Scope
- from src.possibilities import Possibility as P
- from tests.rulestestcase import RulesTestCase, tree
- class TestRulesLineq(RulesTestCase):
- def test_match_subtract_addition_term(self):
- root, a = tree('x + a = b, a')
- self.assertEqualPos(match_subtract_addition_term(root),
- [P(root, subtract_addition_term, (a,))])
- root, cx = tree('x = b + cx, cx')
- self.assertEqualPos(match_subtract_addition_term(root),
- [P(root, subtract_addition_term, (cx,))])
- def test_subtract_addition_term(self):
- root, a, expect = tree('x + a = b, a, x + a - a = b - a')
- self.assertEqual(subtract_addition_term(root, (a,)), expect)
|