summaryrefslogtreecommitdiff
path: root/Lib/test/test_htmlparser.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-02-13 20:36:55 +0200
committerEzio Melotti <ezio.melotti@gmail.com>2012-02-13 20:36:55 +0200
commit369cbd744ed06b3e01fe7a2e6a86ea4d85250231 (patch)
tree3cd0eacf3c320dcc5ec695529b2f68ebbf041268 /Lib/test/test_htmlparser.py
parentef18737b7f920bc9e8f406cfb71730b9f07c13f5 (diff)
downloadcpython-git-369cbd744ed06b3e01fe7a2e6a86ea4d85250231.tar.gz
Fix an index, add more tests, avoid raising errors for unknown declarations, and clean up comments.
Diffstat (limited to 'Lib/test/test_htmlparser.py')
-rw-r--r--Lib/test/test_htmlparser.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
index c15bb660e2..6667512785 100644
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -215,6 +215,30 @@ text
self._parse_error("<a foo='>'")
self._parse_error("<a foo='>")
+ def test_valid_doctypes(self):
+ # from http://www.w3.org/QA/2002/04/valid-dtd-list.html
+ dtds = ['HTML', # HTML5 doctype
+ ('HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" '
+ '"http://www.w3.org/TR/html4/strict.dtd"'),
+ ('HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" '
+ '"http://www.w3.org/TR/html4/loose.dtd"'),
+ ('html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '
+ '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"'),
+ ('html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" '
+ '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"'),
+ ('math PUBLIC "-//W3C//DTD MathML 2.0//EN" '
+ '"http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"'),
+ ('html PUBLIC "-//W3C//DTD '
+ 'XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" '
+ '"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"'),
+ ('svg PUBLIC "-//W3C//DTD SVG 1.1//EN" '
+ '"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"'),
+ 'html PUBLIC "-//IETF//DTD HTML 2.0//EN"',
+ 'html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"']
+ for dtd in dtds:
+ self._run_check("<!DOCTYPE %s>" % dtd,
+ [('decl', 'DOCTYPE ' + dtd)])
+
def test_declaration_junk_chars(self):
self._run_check("<!DOCTYPE foo $ >", [('decl', 'DOCTYPE foo $ ')])