def test_prefix_parsing(self): # {{{ self.ae(parse_prefixes('foaf: http://xmlns.com/foaf/spec/\n dbp: http://dbpedia.org/ontology/'), {'foaf':'http://xmlns.com/foaf/spec/', 'dbp': 'http://dbpedia.org/ontology/'}) for raw, expanded in ( ('onix:xxx', reserved_prefixes['onix'] + ':xxx'), ('xxx:onix', 'xxx:onix'), ('xxx', 'xxx'), ): self.ae(expand_prefix(raw, reserved_prefixes.copy()), expanded) root = self.get_opf() ensure_prefix(root, read_prefixes(root), 'calibre', 'https://calibre-ebook.com') ensure_prefix(root, read_prefixes(root), 'marc', reserved_prefixes['marc']) self.ae(parse_prefixes(root.get('prefix')), {'calibre': 'https://calibre-ebook.com'})
def test_prefix_parsing(self): # {{{ self.ae(parse_prefixes('foaf: http://xmlns.com/foaf/spec/\n dbp: http://dbpedia.org/ontology/'), {'foaf':'http://xmlns.com/foaf/spec/', 'dbp': 'http://dbpedia.org/ontology/'}) for raw, expanded in ( ('onix:xxx', reserved_prefixes['onix'] + ':xxx'), ('xxx:onix', 'xxx:onix'), ('xxx', 'xxx'), ): self.ae(expand_prefix(raw, reserved_prefixes.copy()), expanded) root = self.get_opf() ensure_prefix(root, read_prefixes(root), 'calibre', 'https://calibre-ebook.com') ensure_prefix(root, read_prefixes(root), 'marc', reserved_prefixes['marc']) self.ae(parse_prefixes(root.get('prefix')), {'calibre': 'https://calibre-ebook.com'})