diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2016-08-20 19:36:31 +0530 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2016-08-20 19:36:31 +0530 |
commit | f7dcf7d80eed6248f9297965388aaa3ac661ebd4 (patch) | |
tree | fc2ef6472d4884f2a90c3681733a53252020ede5 /src | |
parent | 8bd3f2159f60640e5459ca6cd4ab9c6da3c7786a (diff) | |
download | python-lxml-f7dcf7d80eed6248f9297965388aaa3ac661ebd4.tar.gz |
Add tests for the default_doctype option
Diffstat (limited to 'src')
-rw-r--r-- | src/lxml/tests/test_htmlparser.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lxml/tests/test_htmlparser.py b/src/lxml/tests/test_htmlparser.py index 386c63f3..96a33d63 100644 --- a/src/lxml/tests/test_htmlparser.py +++ b/src/lxml/tests/test_htmlparser.py @@ -179,6 +179,14 @@ class HtmlParserTestCase(HelperTestCase): self.assertRaises(self.etree.XMLSyntaxError, parse, f, parser) + def test_module_parse_html_default_doctype(self): + parser = self.etree.HTMLParser(default_doctype=False) + d = html.fromstring('<!DOCTYPE html><h1>S</h1></html>', parser=parser) + self.assertEqual(d.getroottree().docinfo.doctype, '<!DOCTYPE html>') + + d = html.fromstring('<html><h1>S</h1></html>', parser=parser) + self.assertEqual(d.getroottree().docinfo.doctype, '') + def test_parse_encoding_8bit_explicit(self): text = _str('Søk på nettet') html_latin1 = (_str('<p>%s</p>') % text).encode('iso-8859-1') |