本文整理汇总了Python中tegaki.character.Character.save方法的典型用法代码示例。如果您正苦于以下问题:Python Character.save方法的具体用法?Python Character.save怎么用?Python Character.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tegaki.character.Character
的用法示例。
在下文中一共展示了Character.save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testConstructorAndSave
# 需要导入模块: from tegaki.character import Character [as 别名]
# 或者: from tegaki.character.Character import save [as 别名]
def testConstructorAndSave(self):
file_ = os.path.join(self.currdir, "data", "character.xml")
for f in (file_, file_ + ".gzip", file_ + ".bz2", None):
char = Character(f)
if f:
self._testReadXML(char) # check that it is correctly loaded
files = map(tempfile.mkstemp, (".xml", ".xml.gz", ".xml.bz2"))
output_paths = [path for fd,path in files]
for path in output_paths:
try:
# check that save with a path argument works
char.save(path)
newchar = Character(path)
self.assertEquals(char, newchar)
finally:
os.unlink(path)
try:
# check that save with a path argument works
newchar.save()
newchar2 = Character(path)
self.assertEquals(char, newchar2)
finally:
os.unlink(path)
char = Character()
self.assertRaises(ValueError, char.save)