summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulien Cristau <julien.cristau@logilab.fr>2014-11-28 14:23:50 +0100
committerJulien Cristau <julien.cristau@logilab.fr>2014-11-28 14:23:50 +0100
commit20fece159101728c243b660e69cefdb0dceddcb9 (patch)
treed7fb119ca4e331e9ef584f6c3d048ef1721a7890 /test
parent6da786adbb6f7ad3e2d8bd31db6151778a08685b (diff)
downloadlogilab-common-20fece159101728c243b660e69cefdb0dceddcb9.tar.gz
Fix python3 syntax errors
Closes #278550
Diffstat (limited to 'test')
-rw-r--r--test/data/module.py30
-rw-r--r--test/data/module2.py8
-rw-r--r--test/data/noendingnewline.py8
-rw-r--r--test/data/nonregr.py4
-rw-r--r--test/data/sub/momo.py4
5 files changed, 20 insertions, 34 deletions
diff --git a/test/data/module.py b/test/data/module.py
index 62de658..493e676 100644
--- a/test/data/module.py
+++ b/test/data/module.py
@@ -1,7 +1,7 @@
# -*- coding: Latin-1 -*-
"""test module for astng
"""
-
+from __future__ import print_function
from logilab.common import modutils, Execute as spawn
from logilab.common.astutils import *
@@ -21,7 +21,7 @@ def global_access(key, val):
else:
break
else:
- print '!!!'
+ print('!!!')
class YO:
"""hehe"""
@@ -36,7 +36,7 @@ class YO:
except:
raise
-#print '*****>',YO.__dict__
+#print('*****>',YO.__dict__)
class YOUPI(YO):
class_attr = None
@@ -51,9 +51,9 @@ class YOUPI(YO):
local = None
autre = [a for a, b in MY_DICT if b]
if b in autre:
- print 'yo',
+ print('yo', end=' ')
elif a in autre:
- print 'hehe'
+ print('hehe')
global_access(local, val=autre)
finally:
return local
@@ -65,23 +65,5 @@ class YOUPI(YO):
def class_method(cls):
"""class method test"""
- exec a in b
+ exec(a, b)
class_method = classmethod(class_method)
-
-
-def nested_args(a, (b, c, d)):
- """nested arguments test"""
- print a, b, c, d
- while 1:
- if a:
- break
- a += +1
- else:
- b += -2
- if c:
- d = a and b or c
- else:
- c = a and b or d
- map(lambda x, y: (y, x), a)
-
-redirect = nested_args
diff --git a/test/data/module2.py b/test/data/module2.py
index 78976c4..51509f3 100644
--- a/test/data/module2.py
+++ b/test/data/module2.py
@@ -37,14 +37,14 @@ del YO.member
del YO
[SYN1, SYN2] = Concrete0, Concrete1
-assert `1`
+assert '1'
b = 1 | 2 & 3 ^ 8
-exec 'c = 3'
-exec 'c = 3' in {}, {}
+exec('c = 3')
+exec('c = 3', {}, {})
def raise_string(a=2, *args, **kwargs):
raise 'pas glop'
- raise Exception, 'yo'
+ raise Exception('yo')
yield 'coucou'
a = b + 2
diff --git a/test/data/noendingnewline.py b/test/data/noendingnewline.py
index 703b124..110f902 100644
--- a/test/data/noendingnewline.py
+++ b/test/data/noendingnewline.py
@@ -1,4 +1,4 @@
-
+from __future__ import print_function
import unittest
@@ -20,7 +20,7 @@ class TestCase(unittest.TestCase):
def xxx(self):
if False:
pass
- print 'a'
+ print('a')
if False:
pass
@@ -28,9 +28,9 @@ class TestCase(unittest.TestCase):
if False:
pass
- print 'rara'
+ print('rara')
if __name__ == '__main__':
- print 'test2'
+ print('test2')
unittest.main()
diff --git a/test/data/nonregr.py b/test/data/nonregr.py
index 24ecc7c..a4b5ef7 100644
--- a/test/data/nonregr.py
+++ b/test/data/nonregr.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+
try:
enumerate = enumerate
except NameError:
@@ -11,4 +13,4 @@ except NameError:
def toto(value):
for k, v in value:
- print v.get('yo')
+ print(v.get('yo'))
diff --git a/test/data/sub/momo.py b/test/data/sub/momo.py
index e2600f5..746b5d0 100644
--- a/test/data/sub/momo.py
+++ b/test/data/sub/momo.py
@@ -1 +1,3 @@
-print 'yo'
+from __future__ import print_function
+
+print('yo')