[test] extract file read out of call of assertXmlEqual()
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 02 Oct 2019 15:17:35 +0200
changeset 3046 bf353c190352
parent 3045 97f0cc843868
child 3047 63e2c0ef1a8e
[test] extract file read out of call of assertXmlEqual()
test/test_profile_generation.py
--- a/test/test_profile_generation.py	Wed Oct 02 15:09:46 2019 +0200
+++ b/test/test_profile_generation.py	Wed Oct 02 15:17:35 2019 +0200
@@ -932,19 +932,20 @@
 
             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