From 1e6db7b489127e3a87601b8d1f8d66c7b1c5787a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 24 Oct 2017 23:32:24 +0200 Subject: [PATCH] tests: fix AST binop in Perl and Lua --- tests/scripts/python/unparse.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/scripts/python/unparse.py b/tests/scripts/python/unparse.py index 9cc3aa0ed..f3e265a4b 100755 --- a/tests/scripts/python/unparse.py +++ b/tests/scripts/python/unparse.py @@ -334,8 +334,8 @@ class UnparsePerl(UnparsePython): def _ast_binop(self, node): """Add an AST BinOp in output.""" if isinstance(node.op, ast.Add) and \ - (isinstance(node.left, (ast.Name, ast.Str)) or - isinstance(node.right, (ast.Name, ast.Str))): + (not self.is_number(node.left) or + not self.is_number(node.right)): str_op = '.' else: str_op = self.binop[node.op.__class__.__name__] @@ -569,8 +569,8 @@ class UnparseLua(UnparsePython): def _ast_binop(self, node): """Add an AST BinOp in output.""" if isinstance(node.op, ast.Add) and \ - (isinstance(node.left, (ast.Name, ast.Str)) or - isinstance(node.right, (ast.Name, ast.Str))): + (not self.is_number(node.left) or + not self.is_number(node.right)): str_op = '..' else: str_op = self.binop[node.op.__class__.__name__]