[py3] Modernize
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 02 Oct 2019 11:51:39 +0200
changeset 3036 56b3e27c5127
parent 3035 d496f4739032
child 3037 12980f28dd32
[py3] Modernize
cubicweb_seda/migration/0.11.0_Any.py
test/test_profile_generation.py
test/test_views.py
--- a/cubicweb_seda/migration/0.11.0_Any.py	Wed Oct 02 11:46:27 2019 +0200
+++ b/cubicweb_seda/migration/0.11.0_Any.py	Wed Oct 02 11:51:39 2019 +0200
@@ -6,7 +6,7 @@
 # uri. Should be done there but still easier here.
 try:
     from cubicweb_saem_ref.site_cubicweb import init_seda_scheme
-    init_seda_scheme.func_defaults[0][0] = len(LCSV_FILES) - 1
+    init_seda_scheme.__defaults__[0][0] = len(LCSV_FILES) - 1
 except ImportError:
     pass
 
--- a/test/test_profile_generation.py	Wed Oct 02 11:46:27 2019 +0200
+++ b/test/test_profile_generation.py	Wed Oct 02 11:51:39 2019 +0200
@@ -20,12 +20,13 @@
 """
 
 from doctest import Example
-from itertools import chain, izip, repeat
+from itertools import chain, repeat
 import os
 from os.path import basename, join
 import unittest
 
 from six import binary_type, text_type
+from six.moves import zip
 
 from lxml import etree
 from lxml.doctestcompare import LXMLOutputChecker
@@ -191,8 +192,8 @@
         adefs = []
         optattrs = self.xpath(element, 'rng:optional/rng:attribute')
         attrs = self.xpath(element, 'rng:attribute')
-        for use, adef_element in chain(izip(repeat('optional'), optattrs),
-                                       izip(repeat('required'), attrs)):
+        for use, adef_element in chain(zip(repeat('optional'), optattrs),
+                                       zip(repeat('required'), attrs)):
             adef = dict(adef_element.attrib)
             adef['use'] = use
             data_elements = self.xpath(adef_element, 'rng:data')
--- a/test/test_views.py	Wed Oct 02 11:46:27 2019 +0200
+++ b/test/test_views.py	Wed Oct 02 11:51:39 2019 +0200
@@ -19,6 +19,7 @@
 import unittest
 
 from six import text_type
+from six.moves import zip
 
 from cubicweb.devtools.testlib import CubicWebTC
 from cubicweb.web import INTERNAL_FIELD_VALUE
@@ -515,9 +516,9 @@
                 {'p': eid})
             self.assertEqual(len(rset), 2)
             self.assertCountEqual([oeid for __, oeid in rset.rows], to_clone)
-            cardinalities, annotations = zip(*[
+            cardinalities, annotations = list(zip(*[
                 (clone.user_cardinality, clone.user_annotation)
-                for clone in rset.entities()])
+                for clone in rset.entities()]))
             self.assertCountEqual(cardinalities, ('1', '0..1'))
             self.assertCountEqual(annotations, ('plop', 'plouf'))