本文整理汇总了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"])
示例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"])
示例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)
示例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()
示例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)
示例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