Exemplo n.º 1
0
 def blob(self):
     """
     Contents of this package part as a sequence of bytes. May be text or
     binary. Intended to be overridden by subclasses. Default behavior is
     to return load blob.
     """
     if self._element is not None:
         return serialize_part_xml(self._element)
     return self._blob
Exemplo n.º 2
0
 def it_produces_properly_formatted_xml_for_an_opc_part(
         self, part_elm, expected_part_xml):
     """
     Tested aspects:
     ---------------
     * [X] it generates an XML declaration
     * [X] it produces no whitespace between elements
     * [X] it removes any annotations
     * [X] it preserves unused namespaces
     * [X] it returns bytes ready to save to file (not unicode)
     """
     xml = serialize_part_xml(part_elm)
     assert xml == expected_part_xml
     # xml contains 188 chars, of which 3 are double-byte; it will have
     # len of 188 if it's unicode and 191 if it's bytes
     assert len(xml) == 191