summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-10-15 22:56:06 +0200
committerSébastien Helleu <flashcode@flashtux.org>2022-10-15 22:56:06 +0200
commit319abf4fd04df049997dacf9ee02bee1eac5d193 (patch)
treeadb1afca2b0e46950102aa106b27c64be68e1ba1 /tests
parent7a544d5fcfd17536376252963172ea2341236709 (diff)
downloadweechat-319abf4fd04df049997dacf9ee02bee1eac5d193.zip
python: remove support of Python 2.x
Diffstat (limited to 'tests')
-rwxr-xr-xtests/scripts/python/testapigen.py7
-rwxr-xr-xtests/scripts/python/unparse.py9
2 files changed, 4 insertions, 12 deletions
diff --git a/tests/scripts/python/testapigen.py b/tests/scripts/python/testapigen.py
index 43fca9ee0..051a5b808 100755
--- a/tests/scripts/python/testapigen.py
+++ b/tests/scripts/python/testapigen.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2022 Sébastien Helleu <flashcode@flashtux.org>
@@ -41,10 +41,7 @@ import argparse
import ast
from datetime import datetime
import inspect
-try:
- from StringIO import StringIO # python 2
-except ImportError:
- from io import StringIO # python 3
+from io import StringIO
import os
import sys
import traceback
diff --git a/tests/scripts/python/unparse.py b/tests/scripts/python/unparse.py
index 99b6b2869..cb017c678 100755
--- a/tests/scripts/python/unparse.py
+++ b/tests/scripts/python/unparse.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2022 Sébastien Helleu <flashcode@flashtux.org>
@@ -32,10 +32,7 @@ import ast
import inspect
import os
import select
-try:
- from StringIO import StringIO # python 2
-except ImportError:
- from io import StringIO # python 3
+from io import StringIO
import sys
sys.dont_write_bytecode = True
@@ -148,8 +145,6 @@ class UnparsePython(object):
def is_number(self, node): # pylint: disable=no-self-use
"""Check if the node is a number."""
- # in python 2, number -1 is Num(n=-1)
- # in Python 3, number -1 is UnaryOp(op=USub(), operand=Num(n=1))
return (isinstance(node, ast.Num) or
(isinstance(node, ast.UnaryOp) and
isinstance(node.op, (ast.UAdd, ast.USub))))