[test] Import profile_generation module rather than specific names
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 24 Aug 2017 16:22:07 +0200
changeset 2661 21de2d5db256
parent 2660 12ff9f4270d1
child 2662 3572864fe580
[test] Import profile_generation module rather than specific names this will ease testing of other things in this module (as in following cset).
test/test_profile_generation.py
--- a/test/test_profile_generation.py	Wed Aug 16 15:33:06 2017 +0200
+++ b/test/test_profile_generation.py	Thu Aug 24 16:22:07 2017 +0200
@@ -34,7 +34,7 @@
 from cubicweb.devtools.testlib import CubicWebTC
 
 from cubicweb_seda.xsd2yams import XSDMMapping
-from cubicweb_seda.entities.profile_generation import _path_target_values, eid2xmlid
+from cubicweb_seda.entities import profile_generation as pg
 
 from cubicweb_seda import testutils
 
@@ -241,18 +241,18 @@
             #                       ('seda_keyword_type_to', 'subject', 'Concept')]),
             #  ]))
             path = edef[-1][0][1]
-            target_values = _path_target_values(kw, path)
+            target_values = pg._path_target_values(kw, path)
             self.assertEqual(len(target_values), 1)
             target_value = target_values[0]
             self.assertEqual(target_value[0], None)
             self.assertEqual(target_value[1], None)
 
             path = edef[-1][2][1]
-            target_values = _path_target_values(kw, path)
+            target_values = pg._path_target_values(kw, path)
             self.assertEqual(len(target_values), 0)
 
             path = edef[-1][3][1]
-            target_values = _path_target_values(kw, path)
+            target_values = pg._path_target_values(kw, path)
             self.assertEqual(len(target_values), 1)
             target_value = target_values[0]
             self.assertEqual(target_value[0].eid, kt.eid)
@@ -262,7 +262,7 @@
             kw_type = kt_scheme.reverse_in_scheme[0]
             kt.cw_set(seda_keyword_type_to=kw_type)
             path = edef[-1][3][1]
-            target_values = _path_target_values(kw, path)
+            target_values = pg._path_target_values(kw, path)
             self.assertEqual(len(target_values), 1)
             target_value = target_values[0]
             self.assertEqual(target_value[0].eid, kt.eid)
@@ -275,7 +275,7 @@
             #         ('KeywordContent', [('keyword_content', 'subject', 'String')]),
             #     ]))
             path = edef[-1][0][1]
-            target_values = _path_target_values(kw, path)
+            target_values = pg._path_target_values(kw, path)
             self.assertEqual(len(target_values), 1)
             target_value = target_values[0]
             self.assertEqual(target_value[0], None)
@@ -305,7 +305,7 @@
             #      ('SEDABinaryDataObject', 'SEDAPhysicalDataObject'))])])
 
             path = edef[-1][1][1]
-            target_values = _path_target_values(ref, path)
+            target_values = pg._path_target_values(ref, path)
             self.assertEqual(len(target_values), 1)
             target_value = target_values[0]
             self.assertEqual(target_value[0], None)
@@ -665,7 +665,7 @@
         for attrdef in self.xpath(root, '//xs:attribute[@seda:profid]'):
             self.assertEqual(attrdef[0]['type'], 'ID')
         # ensure they are properly referenced using 'default' attribute
-        xmlid = eid2xmlid(self.bdo_eid)
+        xmlid = pg.eid2xmlid(self.bdo_eid)
         references = self.xpath(root, '//rng:element[@a:defaultValue="{}"]'.format(xmlid))
         self.assertEqual(len(references), 1)
         self.assertEqual(references[0].attrib['name'], 'DataObjectReferenceId')