本文整理汇总了Python中UM.Settings.ContainerStack.ContainerStack.deserializeMetadata方法的典型用法代码示例。如果您正苦于以下问题:Python ContainerStack.deserializeMetadata方法的具体用法?Python ContainerStack.deserializeMetadata怎么用?Python ContainerStack.deserializeMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UM.Settings.ContainerStack.ContainerStack
的用法示例。
在下文中一共展示了ContainerStack.deserializeMetadata方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_deserializeInvalidMetadata
# 需要导入模块: from UM.Settings.ContainerStack import ContainerStack [as 别名]
# 或者: from UM.Settings.ContainerStack.ContainerStack import deserializeMetadata [as 别名]
def test_deserializeInvalidMetadata():
# No version
serialised = """
[general]
name = Test
id = testid
"""
with pytest.raises(InvalidContainerStackError):
ContainerStack.deserializeMetadata(serialised, "testid")
# No name
serialised = """
[general]
id = testid
version = {version}
""".format(version=ContainerStack.Version)
with pytest.raises(InvalidContainerStackError):
ContainerStack.deserializeMetadata(serialised, "testid")
示例2: test_deserializeMetadata
# 需要导入模块: from UM.Settings.ContainerStack import ContainerStack [as 别名]
# 或者: from UM.Settings.ContainerStack.ContainerStack import deserializeMetadata [as 别名]
def test_deserializeMetadata():
serialised = """
[general]
name = Test
id = testid
version = {version}
[metadata]
foo = bar
""".format(version=ContainerStack.Version)
metadata = ContainerStack.deserializeMetadata(serialised, "testid")[0]
assert metadata["name"] == "Test"
assert metadata["id"] == "testid"
assert metadata["version"] == str(ContainerStack.Version)