當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。