本文整理汇总了Python中mpx.lib.persistent.PersistentDataObject.purpose方法的典型用法代码示例。如果您正苦于以下问题:Python PersistentDataObject.purpose方法的具体用法?Python PersistentDataObject.purpose怎么用?Python PersistentDataObject.purpose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpx.lib.persistent.PersistentDataObject
的用法示例。
在下文中一共展示了PersistentDataObject.purpose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_upgrade
# 需要导入模块: from mpx.lib.persistent import PersistentDataObject [as 别名]
# 或者: from mpx.lib.persistent.PersistentDataObject import purpose [as 别名]
def test_upgrade(self):
from mpx.upgrade.persistent import persistent_0
old = persistent_0.PersistentDataObject("upgrade_test")
old.purpose = "testing"
old.save()
old_filename = old._persistent.filename
del (old.__dict__["_persistent"])
del (old)
new = PersistentDataObject("upgrade_test")
self.failIf(os.path.exists(old_filename), "Upgrade failed to remove old version")
new.purpose = None
new.load()
self.failUnless(new.purpose == "testing", "Upgrade failed to get old value")
new.destroy()
del (new)