Commit 95372310 authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed non-equal length check issue in non--strict node comparison.

parent efc3c91b
...@@ -253,6 +253,12 @@ class ExpressionNode(Node, ExpressionBase): ...@@ -253,6 +253,12 @@ class ExpressionNode(Node, ExpressionBase):
if self.op in (OP_ADD, OP_MUL): if self.op in (OP_ADD, OP_MUL):
s0 = self.get_scope() s0 = self.get_scope()
s1 = set(other.get_scope()) s1 = set(other.get_scope())
# Scopes sould be of equal size
if len(s0) != len(s1):
return False
# Each node in one scope should have an image node in the other
matched = set() matched = set()
for n0 in s0: for n0 in s0:
......
...@@ -129,6 +129,11 @@ class TestNode(unittest.TestCase): ...@@ -129,6 +129,11 @@ class TestNode(unittest.TestCase):
self.assertTrue(p2.equals(p3)) self.assertTrue(p2.equals(p3))
self.assertFalse(p2.equals(p4)) self.assertFalse(p2.equals(p4))
def test_equals_nary_mary(self):
m0, m1 = tree('ab,2ab')
self.assertFalse(m0.equals(m1))
def test_equals_div(self): def test_equals_div(self):
d0, d1, d2 = tree('a / b,a / b,b / a') d0, d1, d2 = tree('a / b,a / b,b / a')
......
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