当前位置: 首页>>代码示例>>Python>>正文


Python Version.references方法代码示例

本文整理汇总了Python中apidoc.object.source_raw.Version.references方法的典型用法代码示例。如果您正苦于以下问题:Python Version.references方法的具体用法?Python Version.references怎么用?Python Version.references使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apidoc.object.source_raw.Version的用法示例。


在下文中一共展示了Version.references方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_replace_references

# 需要导入模块: from apidoc.object.source_raw import Version [as 别名]
# 或者: from apidoc.object.source_raw.Version import references [as 别名]
    def test_replace_references(self):
        root = Root()

        version1 = Version()

        method1 = Method()
        type1 = Type()

        object_reference1 = ObjectReference()
        object_reference1.reference_name = "r1"
        object_reference1.name = "a"

        object_reference2 = ObjectReference()
        object_reference2.reference_name = "r1"
        object_reference2.name = "a"

        object1 = ObjectObject()
        object1.description = "b"

        method1.request_body = object_reference1
        type1.item = object_reference2

        version1.references = {"r1": object1}
        version1.methods = {"m1": method1}
        version1.types = {"t1": type1}

        root.versions = {"v1": version1}

        self.source.replace_references(root)

        self.assertEqual("a", method1.request_body.name)
        self.assertEqual("b", method1.request_body.description)
        self.assertEqual("a", type1.item.name)
        self.assertEqual("b", type1.item.description)
开发者ID:MartinThoma,项目名称:apidoc,代码行数:36,代码来源:test_source.py

示例2: create_from_name_and_dictionary

# 需要导入模块: from apidoc.object.source_raw import Version [as 别名]
# 或者: from apidoc.object.source_raw.Version import references [as 别名]
    def create_from_name_and_dictionary(self, name, datas):
        """Return a populated object Version from dictionary datas
        """
        version = ObjectVersion()
        self.set_common_datas(version, name, datas)

        if "uri" in datas:
            version.uri = str(datas["uri"])
        if "major" in datas:
            version.major = int(datas["major"])
        if "minor" in datas:
            version.minor = int(datas["minor"])
        if "status" in datas:
            version.status = self.get_enum("status", ObjectVersion.Status, datas)

        version.methods = self.method_factory.create_dictionary_of_element_from_dictionary("methods", datas)
        version.types = self.type_factory.create_dictionary_of_element_from_dictionary("types", datas)
        version.references = self.reference_factory.create_dictionary_of_element_from_dictionary("references", datas)

        return version
开发者ID:MartinThoma,项目名称:apidoc,代码行数:22,代码来源:version.py


注:本文中的apidoc.object.source_raw.Version.references方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。