[test] Move utility function to the top of the file
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 20 Jul 2016 11:40:51 +0200
changeset 1435 7081d6248f81
parent 1434 6fdbd3596d05
child 1436 9d3aae1b9c60
[test] Move utility function to the top of the file
test/test_xsd2yams.py
--- a/test/test_xsd2yams.py	Wed Jul 20 11:40:22 2016 +0200
+++ b/test/test_xsd2yams.py	Wed Jul 20 11:40:51 2016 +0200
@@ -25,6 +25,20 @@
 from cubes.seda.xsd2yams import xsy_mapping, YamsSchemaGenerator, XSDMMapping
 
 
+def readable_edef(edef):
+
+    def name(e):
+        return getattr(e, 'local_name', e.__class__.__name__)
+
+    if len(edef) == 3:
+        return (name(edef[0]), edef[1],
+                [(name(rdef[0].target), [x[:-1] for x in rdef[1]])
+                for rdef in edef[2]])
+    else:
+        return (edef[0], [(name(rdef[0].target), [x[:-1] for x in rdef[1]])
+                          for rdef in edef[1]])
+
+
 class CodeGenerationTC(unittest.TestCase):
 
     def test_base(self):
@@ -233,19 +247,5 @@
                          'CodeListVersions')
 
 
-def readable_edef(edef):
-
-    def name(e):
-        return getattr(e, 'local_name', e.__class__.__name__)
-
-    if len(edef) == 3:
-        return (name(edef[0]), edef[1],
-                [(name(rdef[0].target), [x[:-1] for x in rdef[1]])
-                for rdef in edef[2]])
-    else:
-        return (edef[0], [(name(rdef[0].target), [x[:-1] for x in rdef[1]])
-                          for rdef in edef[1]])
-
-
 if __name__ == '__main__':
     unittest.main()