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


Python IIIFInfo.compliance方法代码示例

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


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

示例1: test03_level

# 需要导入模块: from iiif.info import IIIFInfo [as 别名]
# 或者: from iiif.info.IIIFInfo import compliance [as 别名]
 def test03_level(self):
     """Test level handling."""
     i = IIIFInfo()
     i.compliance_prefix = "prefix/"
     i.compliance_suffix = "/suffix"
     # and good
     i.compliance = "prefix/2/suffix"
     self.assertEqual(i.level, 2)
     i.compliance = "prefix/3/suffix"
     self.assertEqual(i.level, 3)
     # and bad
     i.compliance = ""
     # FIXME: how to avoid wrapping @property call in lamda?
     self.assertRaises(IIIFInfoError, lambda: i.level)
     i.compliance = "prefix//suffix"
     self.assertRaises(IIIFInfoError, lambda: i.level)
     i.compliance = "prefix/22/suffix"
     self.assertRaises(IIIFInfoError, lambda: i.level)
     i.compliance = "prefix/junk/suffix"
     self.assertRaises(IIIFInfoError, lambda: i.level)
     i.compliance = "extra/prefix/2/suffix"
     self.assertRaises(IIIFInfoError, lambda: i.level)
     i.compliance = "...2/suffix"
     self.assertRaises(IIIFInfoError, lambda: i.level)
     i.compliance = "prefix/2..."
     self.assertRaises(IIIFInfoError, lambda: i.level)
     i.compliance = "prefix/2/suffix/extra"
     self.assertRaises(IIIFInfoError, lambda: i.level)
开发者ID:edsilv,项目名称:iiif,代码行数:30,代码来源:test_info_common.py

示例2: test05_level_and_profile

# 需要导入模块: from iiif.info import IIIFInfo [as 别名]
# 或者: from iiif.info.IIIFInfo import compliance [as 别名]
 def test05_level_and_profile(self):
     """Test level and profile setting."""
     i = IIIFInfo(api_version='2.1')
     i.level = 0
     self.assertEqual(i.level, 0)
     self.assertEqual(i.compliance, "http://iiif.io/api/image/2/level0.json")
     i.level = 2
     self.assertEqual(i.level, 2)
     self.assertEqual(i.compliance, "http://iiif.io/api/image/2/level2.json")
     # Set via compliance
     i.compliance = "http://iiif.io/api/image/2/level1.json"
     self.assertEqual(i.level, 1)
     # Set via profile
     i.profile = ["http://iiif.io/api/image/2/level1.json"]
     self.assertEqual(i.level, 1)
     # Set new via compliance
     i = IIIFInfo(api_version='2.1')
     i.compliance = "http://iiif.io/api/image/2/level1.json"
     self.assertEqual(i.level, 1)
开发者ID:edsilv,项目名称:iiif,代码行数:21,代码来源:test_info_2_1.py


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