1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

tests: migrate away from removed ast features

See https://github.com/python/cpython/pull/119563.
This commit is contained in:
LuK1337
2024-10-30 12:58:06 +01:00
committed by Sébastien Helleu
parent aab657bcfd
commit c079852deb
2 changed files with 33 additions and 40 deletions
+4 -4
View File
@@ -144,8 +144,8 @@ class WeechatScript(object): # pylint: disable=too-many-instance-attributes
}
# replace variables
for node in ast.walk(self.tree):
if isinstance(node, ast.Str) and node.s in variables:
node.s = variables[node.s]
if isinstance(node, ast.Constant) and node.value in variables:
node.value = variables[node.value]
def write_header(self, output):
"""Generate script header (just comments by default)."""
@@ -336,8 +336,8 @@ def update_nodes(tree):
output = StringIO()
unparsed = UnparsePython(output=output)
unparsed.add(node.args[0])
node.args.append(ast.Str(output.getvalue()))
node.args.append(ast.Str(str(node.func.lineno)))
node.args.append(ast.Constant(output.getvalue()))
node.args.append(ast.Constant(str(node.func.lineno)))
def get_tests(path):