Mercurial > p > roundup > code
comparison test/html_norm.py @ 6996:3546f23ea493
Add support for python2.
My development install has a backport for html.parser so it didn't
fail import but did in CI.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 02 Oct 2022 23:46:24 -0400 |
| parents | dc83ebff4c90 |
| children | 5bc36b65d06b |
comparison
equal
deleted
inserted
replaced
| 6995:dc83ebff4c90 | 6996:3546f23ea493 |
|---|---|
| 16 tests. Simlarly BeautifulSoup could be used to pretty print the html | 16 tests. Simlarly BeautifulSoup could be used to pretty print the html |
| 17 but again then BeautifulSoup would need to be instaled to run the | 17 but again then BeautifulSoup would need to be instaled to run the |
| 18 tests. | 18 tests. |
| 19 | 19 |
| 20 """ | 20 """ |
| 21 from html.parser import HTMLParser | 21 try: |
| 22 from html.parser import HTMLParser | |
| 23 except ImportError: | |
| 24 from HTMLParser import HTMLParser # python2 | |
| 22 | 25 |
| 23 try: | 26 try: |
| 24 from htmlentitydefs import name2codepoint | 27 from htmlentitydefs import name2codepoint |
| 25 except ImportError: | 28 except ImportError: |
| 26 pass # assume running under python3, name2codepoint predefined | 29 pass # assume running under python3, name2codepoint predefined |
