Ejemplo n.º 1
0
 def test_xml_writer_version(self):
     doc = odml.Document()
     if sys.version_info < (3, 0):
         val = unicode(xmlparser.XMLWriter(doc))
     else:
         val = str(xmlparser.XMLWriter(doc))
     self.assertIn('version="%s"' % xmlparser.XML_VERSION, val)
     doc = xmlparser.XMLReader().fromString(val)
Ejemplo n.º 2
0
def dump(doc, filename):
    """
    helper function to dump a document for debugging purposes
    """
    if sys.version_info < (3, 0):
        odml_string = unicode(xmlparser.XMLWriter(doc))
    else:
        odml_string = str(xmlparser.XMLWriter(doc))
    open(filename, "w").write(odml_string)
Ejemplo n.º 3
0
    def test_save_version(self):
        self.doc.version = '2.4'
        writer = xmlparser.XMLWriter(self.doc)
        writer.write_file("/tmp/example.odml")

        restored = xmlparser.load("/tmp/example.odml")
        self.assertEqual(self.doc.version, restored.version)
    def test_save_version(self):
        tmp_file = os.path.join(tempfile.gettempdir(), "example.odml")

        self.doc.version = '2.4'
        writer = xmlparser.XMLWriter(self.doc)
        writer.write_file(tmp_file)

        restored = xmlparser.load(tmp_file)
        self.assertEqual(self.doc.version, restored.version)
def dump(doc, filename):
    """
    Helper function to dump a document for debugging purposes
    """
    odml_string = str(xmlparser.XMLWriter(doc))
    open(filename, "w").write(odml_string)
    def test_xml_writer_version(self):
        doc = odml.Document()
        val = str(xmlparser.XMLWriter(doc))

        self.assertIn('version="%s"' % FORMAT_VERSION, val)
        doc = xmlparser.XMLReader().from_string(val)
Ejemplo n.º 7
0
def dump(doc, filename):
    """
    helper function to dump a document for debugging purposes
    """
    open(filename, "w").write(unicode(xmlparser.XMLWriter(doc)))
Ejemplo n.º 8
0
 def odml_get_data(self, action, obj):
     return unicode(xmlparser.XMLWriter(obj))