本文整理汇总了Python中editxt.project.Project.serialize方法的典型用法代码示例。如果您正苦于以下问题:Python Project.serialize方法的具体用法?Python Project.serialize怎么用?Python Project.serialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.project.Project
的用法示例。
在下文中一共展示了Project.serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from editxt.project import Project [as 别名]
# 或者: from editxt.project.Project import serialize [as 别名]
def test(c):
def objcstr(value):
value = ak.NSString.alloc().initWithString_(value)
isinstance(value, objc.pyobjc_unicode), (type(value), value)
return value
def check(flag, key, serial, value=None):
if flag:
assert key in serial, (key, serial)
if value is not None:
eq_(serial[key], value)
else:
assert key not in serial, key
proj = Project(None)
recent = [objcstr("/file.txt"), objcstr("/doc.xml")]
if c.recent:
proj.recent.extend(Recent(p) for p in recent)
if c.name:
proj.name = objcstr("<name>")
if c.docs:
proj.editors = [MockDoc(1)]
proj.expanded = c.expn
serial = proj.serialize()
check(False, "path", serial, proj.path)
check(c.name, "name", serial, proj.name)
check(c.docs, "documents", serial)
check(True, "expanded", serial, c.expn)
check(c.recent, "recent", serial, recent)
dump_yaml(serial) # verify that it does not crash
示例2: test__init__
# 需要导入模块: from editxt.project import Project [as 别名]
# 或者: from editxt.project.Project import serialize [as 别名]
def test__init__():
proj = Project(Window)
assert proj.path is None
eq_(proj.window, Window)
eq_(len(proj.editors), 0)
eq_(proj.serial_cache, proj.serialize())