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