def testWriteXMLFile(self): char = self._getCharacter() io = StringIO.StringIO() char.write(io) new_char = Character() new_char.read_string(io.getvalue()) self.assertEquals(char, new_char)
def testReadXMLBZ2String(self): file = os.path.join(self.currdir, "data", "character.xml.bz2") file = open(file) string = file.read() file.close() char = Character() char.read_string(string, bz2=True) self._testReadXML(char)
def testReadXMLString(self): file = os.path.join(self.currdir, "data", "character.xml") f = open(file) buf = f.read() f.close() char = Character() char.read_string(buf) self._testReadXML(char)
def _convert_character(data): # converts a BLOB into an object char = Character() char.read_string(base64.b64decode(data), gzip=True) return char