[PATCH 04 of 17 seda] [py3] Modernize

Denis Laxalde denis.laxalde at logilab.fr
Wed Oct 2 16:06:32 CEST 2019


diff --git a/cubicweb_seda/migration/0.11.0_Any.py b/cubicweb_seda/migration/0.11.0_Any.py
index 1073ec9..4019570 100644
--- a/cubicweb_seda/migration/0.11.0_Any.py
+++ b/cubicweb_seda/migration/0.11.0_Any.py
@@ -6,7 +6,7 @@ from cubicweb_seda.dataimport import LCS
 # 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
 
diff --git a/test/test_profile_generation.py b/test/test_profile_generation.py
index a1e69e8..59be6e5 100644
--- a/test/test_profile_generation.py
+++ b/test/test_profile_generation.py
@@ -20,12 +20,13 @@ writing of generated content back to the
 """
 
 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 @@ class RelaxNGTestMixin(XmlTestMixin):
         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')
diff --git a/test/test_views.py b/test/test_views.py
index 77b59d7..81e671c 100644
--- a/test/test_views.py
+++ b/test/test_views.py
@@ -19,6 +19,7 @@ from json import dumps
 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 @@ class CloneImportTC(CubicWebTC):
                 {'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'))
 



More information about the saem-devel mailing list