本文整理匯總了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/')