[PATCH 14 of 17 seda] [test] extract file read out of call of assertXmlEqual()

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


diff --git a/test/test_profile_generation.py b/test/test_profile_generation.py
index d5a1389..62f16f8 100644
--- a/test/test_profile_generation.py
+++ b/test/test_profile_generation.py
@@ -932,19 +932,20 @@ class OldSEDAExportMixin(object):
 
             root = etree.fromstring(generated_xsd)
             self.assertXmlValid(root)
-            with open(self.datapath(expected_file)) as expected:
-                self.assertXmlEqual(expected.read()
-                                    % {'unit-eid': binary_type(self.unit_eid),
-                                       'subunit1-eid': binary_type(self.subunit1_eid),
-                                       'subunit2-eid': binary_type(self.subunit2_eid),
-                                       'bdo-eid': binary_type(self.bdo_eid),
-                                       'kw-eid': binary_type(self.kw_eid),
-                                       'chi-eid': binary_type(self.chi_eid),
-                                       'concept-uri': binary_type(file_concept.cwuri),
-                                       'scheme-uri': binary_type(file_concept.scheme.cwuri),
-                                       'agent-id': binary_type(agent.eid),
-                                       'agent-name': binary_type(agent.dc_title())},
-                                    generated_xsd)
+            with open(self.datapath(expected_file)) as f:
+                expected = f.read() % {
+                    'unit-eid': binary_type(self.unit_eid),
+                    'subunit1-eid': binary_type(self.subunit1_eid),
+                    'subunit2-eid': binary_type(self.subunit2_eid),
+                    'bdo-eid': binary_type(self.bdo_eid),
+                    'kw-eid': binary_type(self.kw_eid),
+                    'chi-eid': binary_type(self.chi_eid),
+                    'concept-uri': binary_type(file_concept.cwuri),
+                    'scheme-uri': binary_type(file_concept.scheme.cwuri),
+                    'agent-id': binary_type(agent.eid),
+                    'agent-name': binary_type(agent.dc_title()),
+                }
+            self.assertXmlEqual(expected, generated_xsd)
             return adapter, root
 
 



More information about the saem-devel mailing list