Commit f46cf729 authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed negation in rule message.

parent 57dba53e
...@@ -116,7 +116,7 @@ def match_negated_division(node): ...@@ -116,7 +116,7 @@ def match_negated_division(node):
if a.negated and b.negated: if a.negated and b.negated:
return [P(node, double_negated_division, ())] return [P(node, double_negated_division, ())]
elif b.negated: elif b.negated:
return [P(node, single_negated_division, (a, b))] return [P(node, single_negated_division, (a, +b))]
return [] return []
...@@ -129,7 +129,7 @@ def single_negated_division(root, args): ...@@ -129,7 +129,7 @@ def single_negated_division(root, args):
# FIXME: "-a/b" results in "-(a/b)", which will cause a loop. # FIXME: "-a/b" results in "-(a/b)", which will cause a loop.
return -a / +b return -a / b
MESSAGES[single_negated_division] = \ MESSAGES[single_negated_division] = \
......
...@@ -61,7 +61,7 @@ class TestRulesNegation(RulesTestCase): ...@@ -61,7 +61,7 @@ class TestRulesNegation(RulesTestCase):
l1, l2 = root = tree('1 / -2') l1, l2 = root = tree('1 / -2')
possibilities = match_negated_division(root) possibilities = match_negated_division(root)
self.assertEqualPos(possibilities, self.assertEqualPos(possibilities,
[P(root, single_negated_division, (l1, l2))]) [P(root, single_negated_division, (l1, +l2))])
def test_match_negated_division_double(self): def test_match_negated_division_double(self):
root = tree('-1 / -2') root = tree('-1 / -2')
...@@ -72,7 +72,7 @@ class TestRulesNegation(RulesTestCase): ...@@ -72,7 +72,7 @@ class TestRulesNegation(RulesTestCase):
def test_single_negated_division(self): def test_single_negated_division(self):
l1, l2 = root = tree('1 / -2') l1, l2 = root = tree('1 / -2')
self.assertEqualNodes(single_negated_division(root, (l1, l2)), self.assertEqualNodes(single_negated_division(root, (l1, +l2)),
-l1 / +l2) -l1 / +l2)
def test_double_negated_division(self): def test_double_negated_division(self):
......
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