Allow mismatched units in expressions
This commit is contained in:
@@ -83,7 +83,11 @@ class Expression(Node):
|
||||
if ua == ub:
|
||||
return str(val) + ua
|
||||
else:
|
||||
raise SyntaxError("Error in expression %s != %s" % (ua, ub))
|
||||
# Nodejs version does not seem to mind mismatched
|
||||
# units within expressions. So we choose the first
|
||||
# as they do
|
||||
# raise SyntaxError("Error in expression %s != %s" % (ua, ub))
|
||||
return str(val) + ua
|
||||
elif ua:
|
||||
return str(val) + ua
|
||||
elif ub:
|
||||
|
||||
@@ -50,10 +50,6 @@ class TestExpression(unittest.TestCase):
|
||||
e = Expression(test[:3])
|
||||
self.assertEqual(test[3], e.parse(None), test)
|
||||
|
||||
def testinput(self):
|
||||
e = Expression(['1a', '+', '1b'])
|
||||
self.assertRaises(SyntaxError, e.parse, None)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user