test_strategy.py 609 B

123456789101112131415
  1. from src.rules.factors import expand_double, expand_single
  2. from src.node import Scope
  3. from src.possibilities import Possibility as P
  4. from src.strategy import find_possibilities
  5. from tests.rulestestcase import RulesTestCase, tree
  6. class TestStrategy(RulesTestCase):
  7. def test_find_possibilities_sort(self):
  8. (ab, cd), e = root = tree('(a + b)(c + d)e')
  9. self.assertEqualPos(find_possibilities(root),
  10. [P(root, expand_single, (Scope(root), cd, e)),
  11. P(root, expand_single, (Scope(root), ab, e)),
  12. P(root, expand_double, (Scope(root), ab, cd))])