Exemplo n.º 1
0
 def test18_url(self):
     r = IIIFRequest()
     r.size = None 
     r.size_wh = [11,22]
     self.assertEqual( r.url(identifier='abc1'), 'abc1/full/11,22/0/default' )
     r.size_wh = [100,None]
     self.assertEqual( r.url(identifier='abc2'), 'abc2/full/100,/0/default' )
     r.size_wh = [None,999]
     self.assertEqual( r.url(identifier='abc3'), 'abc3/full/,999/0/default' )
     r.size_wh = None
     self.assertEqual( r.url(identifier='abc4'), 'abc4/full/full/0/default' )
Exemplo n.º 2
0
 def test18_url(self):
     """Test url() method."""
     r = IIIFRequest(api_version='2.1')
     r.size = None
     r.size_wh = [11, 22]
     self.assertEqual(r.url(identifier='abc1'), 'abc1/full/11,22/0/default')
     r.size_wh = [100, None]
     self.assertEqual(r.url(identifier='abc2'), 'abc2/full/100,/0/default')
     r.size_wh = [None, 999]
     self.assertEqual(r.url(identifier='abc3'), 'abc3/full/,999/0/default')
     r.size_wh = None
     self.assertEqual(r.url(identifier='abc4'), 'abc4/full/full/0/default')
     r = IIIFRequest(api_version='2.1')
     r.size_full = True
     self.assertEqual(r.url(identifier='abc5'), 'abc5/full/full/0/default')
     r = IIIFRequest(api_version='2.1')
     r.size_max = True
     self.assertEqual(r.url(identifier='abc5'), 'abc5/full/max/0/default')
Exemplo n.º 3
0
 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)))
Exemplo n.º 4
0
 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)))
Exemplo n.º 5
0
 def test18_url(self):
     """Test url() method."""
     r = IIIFRequest(api_version='2.1')
     r.size = None
     r.size_wh = [11, 22]
     self.assertEqual(r.url(identifier='abc1'),
                      'abc1/full/11,22/0/default')
     r.size_wh = [100, None]
     self.assertEqual(r.url(identifier='abc2'),
                      'abc2/full/100,/0/default')
     r.size_wh = [None, 999]
     self.assertEqual(r.url(identifier='abc3'),
                      'abc3/full/,999/0/default')
     r.size_wh = None
     self.assertEqual(r.url(identifier='abc4'),
                      'abc4/full/full/0/default')
     r = IIIFRequest(api_version='2.1')
     r.size_full = True
     self.assertEqual(r.url(identifier='abc5'),
                      'abc5/full/full/0/default')
     r = IIIFRequest(api_version='2.1')
     r.size_max = True
     self.assertEqual(r.url(identifier='abc5'),
                      'abc5/full/max/0/default')