#32556: assertHTMLEqual gives a confusing error message with empty attributes
-------------------------------------+-------------------------------------
     Reporter:  Baptiste Mispelon    |                    Owner:  Hasan
                                     |  Ramezani
         Type:  Bug                  |                   Status:  new
    Component:  Testing framework    |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Baptiste Mispelon):

 Using the table you linked to, I get the same list of 24 attributes. The
 table is labelled as "non-normative" but I think it would be good enough
 for this usecase.

 I tried various other ways of extracting the list from the spec but this
 table seems like the best method. It's missing `truespeed` which is a
 boolean attribute for the `<marquee>` tag (which is deprecated) so I think
 it's acceptable.

 For reference, here's the script I used to get the list (piped to `sort
 -u` to remove duplicates):
 {{{#!py
 from urllib.request import urlopen

 from lxml import html  # needs to be pip-installed (`pip install lxml`)

 if __name__ == '__main__':
     # The spec is an 11Mb file, downloading it takes a while
     response = urlopen('https://html.spec.whatwg.org')
     tree = html.parse(response)

     for i, row in
 enumerate(tree.xpath('.//table[@id="attributes-1"]/tbody/tr')):
         assert len(row) == 4, f"Expected 4 columns on row {i}, got
 {len(rows)}"
         attr, elements, description, value = (node.text_content().strip()
 for node in row)
         if value == "Boolean attribute":
             print(attr)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32556#comment:9>
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/067.167a81f09f5c3b5e5b60346f19d86955%40djangoproject.com.

Reply via email to