本文整理汇总了Python中iiif.info.IIIFInfo.id方法的典型用法代码示例。如果您正苦于以下问题:Python IIIFInfo.id方法的具体用法?Python IIIFInfo.id怎么用?Python IIIFInfo.id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iiif.info.IIIFInfo
的用法示例。
在下文中一共展示了IIIFInfo.id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test02_id
# 需要导入模块: from iiif.info import IIIFInfo [as 别名]
# 或者: from iiif.info.IIIFInfo import id [as 别名]
def test02_id(self):
"""Test identifier handling."""
i = IIIFInfo()
# setter
i.id = ""
self.assertEqual(i.server_and_prefix, "")
self.assertEqual(i.identifier, "")
i.id = "a"
self.assertEqual(i.server_and_prefix, "")
self.assertEqual(i.identifier, "a")
i.id = "a/b"
self.assertEqual(i.server_and_prefix, "a")
self.assertEqual(i.identifier, "b")
i.id = "a/b/c"
self.assertEqual(i.server_and_prefix, "a/b")
self.assertEqual(i.identifier, "c")
i.id = "a//b"
self.assertEqual(i.server_and_prefix, "a/")
self.assertEqual(i.identifier, "b")
i.id = "/d"
self.assertEqual(i.server_and_prefix, "")
self.assertEqual(i.identifier, "d")
def xx(value): # FIXME - better way to test setter?
i.id = value
self.assertRaises(AttributeError, xx, None)
self.assertRaises(AttributeError, xx, 123)
# property
i.server_and_prefix = ""
i.identifier = ""
self.assertEqual(i.id, "")
i.identifier = "abc"
self.assertEqual(i.id, "abc")
i.server_and_prefix = "def"
self.assertEqual(i.id, "def/abc")
i.identifier = ""
self.assertEqual(i.id, "def/")
示例2: test02_id
# 需要导入模块: from iiif.info import IIIFInfo [as 别名]
# 或者: from iiif.info.IIIFInfo import id [as 别名]
def test02_id(self):
"""Test identifier handling."""
i = IIIFInfo()
# setter
i.id = ''
self.assertEqual(i.server_and_prefix, '')
self.assertEqual(i.identifier, '')
i.id = 'a'
self.assertEqual(i.server_and_prefix, '')
self.assertEqual(i.identifier, 'a')
i.id = 'a/b'
self.assertEqual(i.server_and_prefix, 'a')
self.assertEqual(i.identifier, 'b')
i.id = 'a/b/c'
self.assertEqual(i.server_and_prefix, 'a/b')
self.assertEqual(i.identifier, 'c')
i.id = 'a//b'
self.assertEqual(i.server_and_prefix, 'a/')
self.assertEqual(i.identifier, 'b')
i.id = '/d'
self.assertEqual(i.server_and_prefix, '')
self.assertEqual(i.identifier, 'd')
def xx(value): # FIXME - better way to test setter?
i.id = value
self.assertRaises(AttributeError, xx, None)
self.assertRaises(AttributeError, xx, 123)
# property
i.server_and_prefix = ''
i.identifier = ''
self.assertEqual(i.id, '')
i.identifier = 'abc'
self.assertEqual(i.id, 'abc')
i.server_and_prefix = 'def'
self.assertEqual(i.id, 'def/abc')
i.identifier = ''
self.assertEqual(i.id, 'def/')