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'))
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'))
def testExpandNsTag_backwardsCompatible(self): self.assertEquals('{http://purl.org/dc/elements/1.1/}title', namespaces.expandNsTag('dc:title'))
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'))
def testExpandNsTag_backwardsCompatible(self): self.assertEqual('{http://purl.org/dc/elements/1.1/}title', namespaces.expandNsTag('dc:title'))
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'))