def test_sql_to_odf(self): doc = odf.load(self.file) s1 = odf.dumps(doc) s2 = odf.dumps(odf.SqlToOdf(s1)) self.assertEqual(s1, s2, 'SqlToOdf data is not equal to previously dumped data') fd, name = tempfile.mkstemp() odf.SqlToOdf(s1, name) f = os.fdopen(fd, 'rb') s3 = f.read() f.close() self.assertEqual(s1, s3, 'SqlToOdf file dump is not equal to previously dumped data')
def test_dump(self): doc = odf.load(self.file) s1 = odf.dumps(doc) fd, name = tempfile.mkstemp() odf.dump(doc, name) f = os.fdopen(fd, 'rb') s2 = f.read() f.close() os.remove(name) self.assertEqual(s1, s2, 'File dump is not equal to string dumps')
def test_dumps(self): doc = odf.load(self.file) s = odf.dumps(doc) self.assertTrue(isinstance(odf.loads(s), document.Document))