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


Python IIIFRequest.identifier方法代码示例

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


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

示例1: test01_split_url

# 需要导入模块: from iiif.request import IIIFRequest [as 别名]
# 或者: from iiif.request.IIIFRequest import identifier [as 别名]
    def test01_split_url(self):
        """Test split_url() method.

        For everything except the handling of extension type on
        info.json requests (where v1.0 allows XML), the behavior
        of split_url() is version independent.
        """
        # mismatching baseurl
        r = IIIFRequest()
        r.baseurl = 'http://ex.org/a/'
        self.assertRaises(IIIFRequestError, r.split_url, 'http://other.base.url/')
        # matching baseurl, but bad request
        r = IIIFRequest()
        r.baseurl = 'http://ex.org/a/'
        self.assertRaises(IIIFRequestBaseURI, r.split_url, 'http://ex.org/a/b')
        # matching baseurl, good request
        r = IIIFRequest(baseurl='http://ex.org/a/')
        r.identifier = None
        r.split_url('http://ex.org/a/b/full/full/0/native')
        self.assertEqual(r.identifier, 'b')
        self.assertEqual(r.region, 'full')
        self.assertEqual(r.size, 'full')
        # matching baseurl, insert id, good request
        r = IIIFRequest(baseurl='http://ex.org/a/')
        r.identifier = 'b'
        r.split_url('http://ex.org/a/full/full/0/native')
        self.assertEqual(r.identifier, 'b')
        self.assertEqual(r.region, 'full')
        self.assertEqual(r.size, 'full')
        # matching baseurl, too many segments
        r = IIIFRequest(baseurl='http://ex.org/a/')
        self.assertRaises(IIIFRequestError, r.split_url,
                          'http://ex.org/a/1/2/3/4/5/6')
开发者ID:edsilv,项目名称:iiif,代码行数:35,代码来源:test_request_common.py

示例2: test19_split_url

# 需要导入模块: from iiif.request import IIIFRequest [as 别名]
# 或者: from iiif.request.IIIFRequest import identifier [as 别名]
 def test19_split_url(self):
     # mismatching baseurl
     r = IIIFRequest()
     r.baseurl = 'http://ex.org/a/'
     self.assertRaises( IIIFError, r.split_url, 'http://other.base.url/' )
     # matching baseurl, but bad request
     r = IIIFRequest()
     r.baseurl = 'http://ex.org/a/'
     self.assertRaises( IIIFRequestBaseURI , r.split_url, 'http://ex.org/a/b' )
     # matching baseurl, good request
     r = IIIFRequest()
     r.baseurl = 'http://ex.org/a/'
     r.identifier = None
     r.split_url('http://ex.org/a/b/full/full/0/native')
     self.assertEqual( r.identifier, 'b' )
     self.assertEqual( r.region, 'full' )
     self.assertEqual( r.size, 'full' )
     # matching baseurl, insert id, good request
     r = IIIFRequest()
     r.baseurl = 'http://ex.org/a/'
     r.identifier = 'b'
     r.split_url('http://ex.org/a/full/full/0/native')
     self.assertEqual( r.identifier, 'b' )
     self.assertEqual( r.region, 'full' )
     self.assertEqual( r.size, 'full' )
     # matching baseurl, too many segments
     r = IIIFRequest()
     r.baseurl = 'http://ex.org/a/'
     self.assertRaises( IIIFError, r.split_url, 'http://ex.org/a/1/2/3/4/5/6' )
     # api_version=1.0, format=xyz -> bad
     r = IIIFRequest(api_version='1.0')
     r.baseurl = 'http://ex.org/a/'
     self.assertRaises( IIIFError, r.split_url, 'http://ex.org/a/b/info.xyz' )
     # api_version=2.1, format=xml -> bad
     r = IIIFRequest(api_version='2.1')
     r.baseurl = 'http://ex.org/a/'
     self.assertRaises( IIIFError, r.split_url, 'http://ex.org/a/b/info.xml' )
     # api_version=2.1, format=xyz -> bad
     r = IIIFRequest(api_version='2.1')
     r.baseurl = 'http://ex.org/a/'
     self.assertRaises( IIIFError, r.split_url, 'http://ex.org/a/b/info.xyz' )
开发者ID:pbinkley,项目名称:iiif,代码行数:43,代码来源:test_request_2_1.py

示例3: test03_str

# 需要导入模块: from iiif.request import IIIFRequest [as 别名]
# 或者: from iiif.request.IIIFRequest import identifier [as 别名]
 def test03_str(self):
     """Simple tests of str() method."""
     r = IIIFRequest()
     r.baseurl = 'http://ex.org/'
     r.identifier = 'abc'
     # info
     r.info = True
     r.format = 'json'
     self.assertTrue(re.search(r'INFO request', str(r)))
     self.assertTrue(re.search(r'format=json', str(r)))
     # non-info
     r.info = False
     r.region = 'R'
     r.size = 'S'
     r.rotation = 'X'
     r.quality = 'Q'
     r.format = 'jpg'
     self.assertFalse(re.search(r'INFO request', str(r)))
     self.assertTrue(re.search(r'region=R', str(r)))
     self.assertTrue(re.search(r'format=jpg', str(r)))
开发者ID:edsilv,项目名称:iiif,代码行数:22,代码来源:test_request_common.py


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