lxml/lxml — pull request #43 by dairiki (2012-03-31 22:59:27+00:00)
Title: As promised, here are unit tests for lxml.html.html5parser

There are three commits in this pull request. The first two should be fairly non-controversial. The third may warrant some discussion.

The first commit fixes an unrelated test which was failing for me.

The second commit includes unit tests for html5parser.py.

The third commit addresses what I think is a bug. When the code in html5parser generates dummy wrapper elements (e.g. a ``

`` to wrap multiple fragments) it currently generates non-namespaced elements. By default the html5lib parser generates namespaced elements, so this is a bit of a mismatch. This patch namespaces these generated wrapper elements when the parser is configured to namespace its output.

Other Notes
-----------------

I've only tested this under python 2.6. I suspect the unit tests will need a little bodywork before they run in py3k.

I have not tested the unit tests for the XHTMLParser. From what I can tell, html5lib.XHTMLParser is obsolete. My version of html5lib (0.90) does not include it in any case.