コード例 #1
0
ファイル: opf3_test.py プロジェクト: Farb/calibre
 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'})
コード例 #2
0
 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'})
コード例 #3
0
ファイル: opf3_test.py プロジェクト: mkhuramj/calibre
 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), expanded)
コード例 #4
0
 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), expanded)