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


Python Version.major方法代码示例

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


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

示例1: test_define_changes_status__updated

# 需要导入模块: from apidoc.object.source_raw import Version [as 别名]
# 或者: from apidoc.object.source_raw.Version import major [as 别名]
    def test_define_changes_status__updated(self):
        root_dto = RootDto()

        version1 = Version()
        version1.name = "v1"
        version1.major = 1
        version1 = VersionDto(version1)
        version2 = Version()
        version2.name = "v2"
        version2.major = 2
        version2 = VersionDto(version2)

        category1 = MethodCategory(Category("c1"))

        method1 = Method()
        method1.changes_status = {"v1": MultiVersion.Changes.new, "v2": MultiVersion.Changes.updated}

        category1.methods = [method1]

        root_dto.versions = [version1, version2]
        root_dto.method_categories = [category1]

        self.factory.define_changes_status(root_dto)

        self.assertEqual(MultiVersion.Changes.new, method1.changes_status["v1"])
        self.assertEqual(MultiVersion.Changes.updated, method1.changes_status["v2"])
开发者ID:bahamut1221,项目名称:apidoc,代码行数:28,代码来源:test_rootDto.py

示例2: test_define_changes_status

# 需要导入模块: from apidoc.object.source_raw import Version [as 别名]
# 或者: from apidoc.object.source_raw.Version import major [as 别名]
    def test_define_changes_status(self):
        root_dto = RootDto()

        version1 = Version()
        version1.name = "v1"
        version1.major = 1
        version1 = VersionDto(version1)
        version2 = Version()
        version2.name = "v2"
        version2.major = 2
        version2 = VersionDto(version2)

        category1 = MethodCategory(Category("c1"))
        category2 = TypeCategory(Category("c2"))

        method1 = Method()
        method1.changes_status = {"v1": MultiVersion.Changes.none}
        method2 = Method()
        method2.changes_status = {"v1": MultiVersion.Changes.new}
        method3 = Method()
        method3.changes_status = {"v2": MultiVersion.Changes.new}

        category1.methods = [method1, method2, method3]

        root_dto.versions = [version1, version2]
        root_dto.method_categories = [category1]
        root_dto.type_categories = [category2]

        self.factory.define_changes_status(root_dto)

        self.assertEqual(MultiVersion.Changes.new, method1.changes_status["v1"])
        self.assertEqual(MultiVersion.Changes.deleted, method2.changes_status["v2"])
        self.assertEqual(MultiVersion.Changes.none, method3.changes_status["v1"])
开发者ID:bahamut1221,项目名称:apidoc,代码行数:35,代码来源:test_rootDto.py

示例3: test_get_previous_version__second

# 需要导入模块: from apidoc.object.source_raw import Version [as 别名]
# 或者: from apidoc.object.source_raw.Version import major [as 别名]
    def test_get_previous_version__second(self):
        version1 = Version()
        version1.name = "v1"
        version1.major = 1
        version2 = Version()
        version2.name = "v2"
        version2.major = 2

        versions = {"v1": version1, "v2": version2}
        response = Hydrator(version2, versions, []).get_previous_version()

        self.assertEqual(version1, response)
开发者ID:bahamut1221,项目名称:apidoc,代码行数:14,代码来源:test_rootDto.py

示例4: test_get_previous_version__unknown

# 需要导入模块: from apidoc.object.source_raw import Version [as 别名]
# 或者: from apidoc.object.source_raw.Version import major [as 别名]
    def test_get_previous_version__unknown(self):
        version1 = Version()
        version1.name = "v1"
        version1.major = 1
        version2 = Version()
        version2.name = "v2"
        version2.major = 2
        version3 = Version()
        version3.name = "v3"
        version3.major = 3

        versions = {"v1": version1, "v2": version2}
        with self.assertRaises(ValueError):
            Hydrator(version3, versions, []).get_previous_version()
开发者ID:bahamut1221,项目名称:apidoc,代码行数:16,代码来源:test_rootDto.py

示例5: test_version

# 需要导入模块: from apidoc.object.source_raw import Version [as 别名]
# 或者: from apidoc.object.source_raw.Version import major [as 别名]
    def test_version(self):
        version = Version()
        version.name = "a"
        version.description = "b"
        version.uri = "c"
        version.major = 2
        version.minor = 3
        version.status = Version.Status.draft

        version_dto = VersionDto(version)

        self.assertEqual("a", version_dto.name)
        self.assertEqual("b", version_dto.description)
        self.assertEqual("c", version_dto.uri)
        self.assertEqual(2, version_dto.major)
        self.assertEqual(3, version_dto.minor)
开发者ID:bahamut1221,项目名称:apidoc,代码行数:18,代码来源:test_source_dto.py

示例6: create_from_name_and_dictionary

# 需要导入模块: from apidoc.object.source_raw import Version [as 别名]
# 或者: from apidoc.object.source_raw.Version import major [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.major方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。