Resolve the official dated DBLP DTD locally and preserve source encoding
Metadata integrity checks / metadata (push) Successful in 6s
Metadata integrity checks / metadata (push) Successful in 6s
This commit is contained in:
@@ -34,6 +34,12 @@ class DblpCatalogueTests(unittest.TestCase):
|
||||
path=self.archive('',doctype='<!DOCTYPE dblp SYSTEM "https://example.org/evil.dtd">')
|
||||
with self.assertRaisesRegex(ValueError,'pinned external'):list(records(path,self.dtd.read_bytes()))
|
||||
|
||||
def test_real_monthly_dtd_name_and_latin1_encoding(self):
|
||||
path=self.root/'monthly.xml.gz'
|
||||
xml='<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE dblp SYSTEM "dblp-2023-06-28.dtd"><dblp><inproceedings key="conf/aaai/one"><author>René</author><title>Metadata</title></inproceedings></dblp>'
|
||||
with gzip.open(path,'wb') as stream:stream.write(xml.encode('latin1'))
|
||||
self.assertEqual(list(records(path,self.dtd.read_bytes()))[0]['fields']['author'],['René'])
|
||||
|
||||
def test_internal_entities_are_rejected(self):
|
||||
path=self.archive('',doctype='<!DOCTYPE dblp SYSTEM "dblp.dtd" [<!ENTITY x "expanded">]>')
|
||||
with self.assertRaisesRegex(ValueError,'pinned external'):list(records(path,self.dtd.read_bytes()))
|
||||
|
||||
Reference in New Issue
Block a user