summaryrefslogtreecommitdiff
path: root/tests/scripts/python/unparse.py
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2017-10-24 23:32:24 +0200
committerSébastien Helleu <flashcode@flashtux.org>2017-10-24 23:32:24 +0200
commit1e6db7b489127e3a87601b8d1f8d66c7b1c5787a (patch)
tree05baaea0215f124a1c8f55e7685e9df056a82e82 /tests/scripts/python/unparse.py
parent4cff2322a0161cda78f8aa06b929a057e887ea46 (diff)
downloadweechat-1e6db7b489127e3a87601b8d1f8d66c7b1c5787a.zip
tests: fix AST binop in Perl and Lua
Diffstat (limited to 'tests/scripts/python/unparse.py')
-rwxr-xr-xtests/scripts/python/unparse.py8
1 files 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__]