Пример #1
0
 def testTagToCurie(self):
     self.assertEquals('dc:title', namespaces.tagToCurie('{http://purl.org/dc/elements/1.1/}title'))
     self.assertRaises(KeyError, namespaces.tagToCurie, '{unknown}tag')
     self.assertRaises(ValueError, namespaces.tagToCurie, 'no-uri-in-tag')
     self.assertEquals('srw:records', namespaces.tagToCurie(namespaces.expandNsTag('srw:records')))
     ns2 = namespaces.copyUpdate({'new':'uri:new'})
     self.assertEquals('new:tag', ns2.tagToCurie('{uri:new}tag'))
Пример #2
0
 def testTagToCurie(self):
     self.assertEqual(
         'dc:title',
         namespaces.tagToCurie('{http://purl.org/dc/elements/1.1/}title'))
     self.assertRaises(KeyError, namespaces.tagToCurie, '{unknown}tag')
     self.assertRaises(ValueError, namespaces.tagToCurie, 'no-uri-in-tag')
     self.assertEqual(
         'srw:records',
         namespaces.tagToCurie(namespaces.expandNsTag('srw:records')))
     ns2 = namespaces.copyUpdate({'new': 'uri:new'})
     self.assertEqual('new:tag', ns2.tagToCurie('{uri:new}tag'))
Пример #3
0
 def testExpandNsTag_backwardsCompatible(self):
     self.assertEquals('{http://purl.org/dc/elements/1.1/}title', namespaces.expandNsTag('dc:title'))
Пример #4
0
 def testCurieToTag(self):
     self.assertEquals('{http://www.loc.gov/zing/srw/}record', namespaces.expandNsTag('srw:record'))
     self.assertEquals('{http://purl.org/dc/elements/1.1/}title', namespaces.curieToTag('dc:title'))
Пример #5
0
 def testExpandNsTag_backwardsCompatible(self):
     self.assertEqual('{http://purl.org/dc/elements/1.1/}title',
                      namespaces.expandNsTag('dc:title'))
Пример #6
0
 def testCurieToTag(self):
     self.assertEqual('{http://www.loc.gov/zing/srw/}record',
                      namespaces.expandNsTag('srw:record'))
     self.assertEqual('{http://purl.org/dc/elements/1.1/}title',
                      namespaces.curieToTag('dc:title'))