Commit d53719e8 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Fixed previously added rule for all negation cases.

parent ef8ffd44
...@@ -570,7 +570,7 @@ def fraction_in_division(root, args): ...@@ -570,7 +570,7 @@ def fraction_in_division(root, args):
is_nominator, scope, fraction = args is_nominator, scope, fraction = args
nom, denom = root nom, denom = root
if fraction.negated: if fraction.negated or fraction[0].negated:
scope.replace(fraction, fraction[0].negate(fraction.negated)) scope.replace(fraction, fraction[0].negate(fraction.negated))
else: else:
scope.remove(fraction) scope.remove(fraction)
......
...@@ -383,3 +383,15 @@ class TestRulesFractions(RulesTestCase): ...@@ -383,3 +383,15 @@ class TestRulesFractions(RulesTestCase):
root, expected = tree('c / (1 / a * b), (ac) / b') root, expected = tree('c / (1 / a * b), (ac) / b')
self.assertEqual(fraction_in_division(root, self.assertEqual(fraction_in_division(root,
(False, Scope(root[1]), root[1][0])), expected) (False, Scope(root[1]), root[1][0])), expected)
root, expected = tree('c / (-(1 / a) * b), (ac) / ((-1)b)')
self.assertEqual(fraction_in_division(root,
(False, Scope(root[1]), root[1][0])), expected)
root, expected = tree('c / ((-1) / a * b), (ac) / ((-1)b)')
self.assertEqual(fraction_in_division(root,
(False, Scope(root[1]), root[1][0])), expected)
root, expected = tree('c / (1 / (-a) * b), ((-a)c) / b')
self.assertEqual(fraction_in_division(root,
(False, Scope(root[1]), root[1][0])), expected)
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