#32547: assertHTMLEqual allows invalid HTML
---------------------------------------------+------------------------
Reporter: François Poulain | Owner: nobody
Type: Uncategorized | Status: new
Component: Testing framework | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
Hi,
The docs for assertHTMLEqual says "html1 and html2 must be valid HTML.".
The formulation suggest that html validation is enforced. But is is
actually easy to get test succeeding with invalid html. Eg.
```
SimpleTestCase.assertHTMLEqual(None, '<div class="bling" class="blang">',
'<div class="bling" class="blang">')
```
The code rely on Python's HTMLParser
(https://docs.python.org/3/library/html.parser.html) for which the
documentation states it produce parsers "able to parse invalid markup.".
I suggest to correct documentation and/or to enforce validation on the
parser side.
How do you think about it?
--
Ticket URL: <https://code.djangoproject.com/ticket/32547>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.fa6946d174efca3587fc251ec7254d2a%40djangoproject.com.