本文整理汇总了Python中iiif.request.IIIFRequest.rotation方法的典型用法代码示例。如果您正苦于以下问题:Python IIIFRequest.rotation方法的具体用法?Python IIIFRequest.rotation怎么用?Python IIIFRequest.rotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iiif.request.IIIFRequest
的用法示例。
在下文中一共展示了IIIFRequest.rotation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test05_parse_rotation
# 需要导入模块: from iiif.request import IIIFRequest [as 别名]
# 或者: from iiif.request.IIIFRequest import rotation [as 别名]
def test05_parse_rotation(self):
"""Parse rotation."""
r = IIIFRequest(api_version='2.1')
r.parse_rotation('0')
self.assertEqual(r.rotation_mirror, False)
self.assertEqual(r.rotation_deg, 0.0)
r.parse_rotation('0.0000')
self.assertEqual(r.rotation_mirror, False)
self.assertEqual(r.rotation_deg, 0.0)
r.parse_rotation('0.000001')
self.assertEqual(r.rotation_mirror, False)
self.assertEqual(r.rotation_deg, 0.000001)
r.parse_rotation('180')
self.assertEqual(r.rotation_mirror, False)
self.assertEqual(r.rotation_deg, 180.0)
r.parse_rotation('360')
self.assertEqual(r.rotation_mirror, False)
self.assertEqual(r.rotation_deg, 0.0)
r.parse_rotation('!0')
self.assertEqual(r.rotation_mirror, True)
self.assertEqual(r.rotation_deg, 0.0)
r.parse_rotation('!0.000')
self.assertEqual(r.rotation_mirror, True)
self.assertEqual(r.rotation_deg, 0.0)
r.parse_rotation('!123.45678')
self.assertEqual(r.rotation_mirror, True)
self.assertEqual(r.rotation_deg, 123.45678)
# nothing supplied
r.rotation = None
r.parse_rotation()
self.assertEqual(r.rotation_mirror, False)
self.assertEqual(r.rotation_deg, 0.0)
示例2: test06_parse_rotation_bad
# 需要导入模块: from iiif.request import IIIFRequest [as 别名]
# 或者: from iiif.request.IIIFRequest import rotation [as 别名]
def test06_parse_rotation_bad(self):
r = IIIFRequest()
r.rotation='-1'
self.assertRaises( IIIFError, r.parse_rotation )
r.rotation='-0.0000001'
self.assertRaises( IIIFError, r.parse_rotation )
r.rotation='360.0000001'
self.assertRaises( IIIFError, r.parse_rotation )
r.rotation='abc'
self.assertRaises( IIIFError, r.parse_rotation )
r.rotation='1!'
self.assertRaises( IIIFError, r.parse_rotation )
r.rotation='!!4'
self.assertRaises( IIIFError, r.parse_rotation )
示例3: test06_parse_rotation_bad
# 需要导入模块: from iiif.request import IIIFRequest [as 别名]
# 或者: from iiif.request.IIIFRequest import rotation [as 别名]
def test06_parse_rotation_bad(self):
r = IIIFRequest(api_version="1.1")
r.rotation = "-1"
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = "-0.0000001"
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = "360.0000001"
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = "abc"
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = "1!"
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = "!!4"
self.assertRaises(IIIFError, r.parse_rotation)
示例4: test03_str
# 需要导入模块: from iiif.request import IIIFRequest [as 别名]
# 或者: from iiif.request.IIIFRequest import rotation [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)))
示例5: test06_parse_rotation_bad
# 需要导入模块: from iiif.request import IIIFRequest [as 别名]
# 或者: from iiif.request.IIIFRequest import rotation [as 别名]
def test06_parse_rotation_bad(self):
"""Parse rotation - bad requests."""
r = IIIFRequest(api_version='2.1')
r.rotation = '-1'
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = '-0.0000001'
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = '360.0000001'
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = 'abc'
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = '1!'
self.assertRaises(IIIFError, r.parse_rotation)
r.rotation = '!!4'
self.assertRaises(IIIFError, r.parse_rotation)