Fix test/normalize.py so it runs on Python 3.8.#216
Closed
bolinfest wants to merge 1 commit intogithub:masterfrom
Closed
Fix test/normalize.py so it runs on Python 3.8.#216bolinfest wants to merge 1 commit intogithub:masterfrom
bolinfest wants to merge 1 commit intogithub:masterfrom
Conversation
`cgi.escape` was removed in Python 3.8, so fall back to
`html.escape` in that case.
Test Plan:
```
$ python3 -V
Python 3.8.6
$ python3 -m doctest test/normalize.py --verbose
Trying:
normalize_html("<p>a \t b</p>")
Expecting:
'<p>a b</p>'
ok
Trying:
normalize_html("<p>a \t\nb</p>")
Expecting:
'<p>a b</p>'
ok
Trying:
normalize_html("<p>a b</p>")
Expecting:
'<p>a b</p>'
ok
Trying:
normalize_html(" <p>a b</p>")
Expecting:
'<p>a b</p>'
ok
Trying:
normalize_html("<p>a b</p> ")
Expecting:
'<p>a b</p>'
ok
Trying:
normalize_html("\n\t<p>\n\t\ta b\t\t</p>\n\t")
Expecting:
'<p>a b</p>'
ok
Trying:
normalize_html("<i>a b</i> ")
Expecting:
'<i>a b</i> '
ok
Trying:
normalize_html("<br />")
Expecting:
'<br>'
ok
Trying:
normalize_html('<a title="bar" href="proxy.php?url=foo">x</a>')
Expecting:
'<a href="proxy.php?url=foo" title="bar">x</a>'
ok
Trying:
normalize_html("∀&><"")
Expecting:
'\u2200&><"'
ok
16 items had no tests:
normalize
normalize.HTMLParseError
normalize.MyHTMLParser
normalize.MyHTMLParser.__init__
normalize.MyHTMLParser.handle_charref
normalize.MyHTMLParser.handle_comment
normalize.MyHTMLParser.handle_data
normalize.MyHTMLParser.handle_decl
normalize.MyHTMLParser.handle_endtag
normalize.MyHTMLParser.handle_entityref
normalize.MyHTMLParser.handle_pi
normalize.MyHTMLParser.handle_startendtag
normalize.MyHTMLParser.handle_starttag
normalize.MyHTMLParser.is_block_tag
normalize.MyHTMLParser.output_char
normalize.MyHTMLParser.unknown_decl
1 items passed all tests:
10 tests in normalize.normalize_html
10 tests in 17 items.
10 passed and 0 failed.
Test passed.
```
Author
|
Oh, basically the same as #184. This has the |
Member
|
Thanks for your help; I kind of arbitrarily picked #184 instead on the assumption that supporting multiple Python versions is maybe more work than its worth. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cgi.escapewas removed in Python 3.8, so fall back tohtml.escapein that case.Test Plan: