summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_htmlparser.py
diff options
context:
space:
mode:
authorEzio Melotti <none@none>2011-04-07 19:03:31 (GMT)
committerEzio Melotti <none@none>2011-04-07 19:03:31 (GMT)
commit2e3607c1e758865519b28066b8925f37203e2197 (patch)
treeec09ce29a9dcc1bfa91e7e0f65428666332eda41 /Lib/test/test_htmlparser.py
parent9b5ac3efa64d72b54d4f1ab32a95c260b39ab98d (diff)
downloadcpython-2e3607c1e758865519b28066b8925f37203e2197.zip
cpython-2e3607c1e758865519b28066b8925f37203e2197.tar.gz
cpython-2e3607c1e758865519b28066b8925f37203e2197.tar.bz2
#7311: fix html.parser to accept non-ASCII attribute values.
Diffstat (limited to 'Lib/test/test_htmlparser.py')
-rw-r--r--Lib/test/test_htmlparser.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py
index 5ecd016..637ab01 100644
--- a/Lib/test/test_htmlparser.py
+++ b/Lib/test/test_htmlparser.py
@@ -217,6 +217,23 @@ DOCTYPE html [
("starttag", "a", [("href", "mailto:xyz@example.com")]),
])
+ def test_attr_nonascii(self):
+ # see issue 7311
+ self._run_check("<img src=/foo/bar.png alt=\u4e2d\u6587>", [
+ ("starttag", "img", [("src", "/foo/bar.png"),
+ ("alt", "\u4e2d\u6587")]),
+ ])
+ self._run_check("<a title='\u30c6\u30b9\u30c8' "
+ "href='\u30c6\u30b9\u30c8.html'>", [
+ ("starttag", "a", [("title", "\u30c6\u30b9\u30c8"),
+ ("href", "\u30c6\u30b9\u30c8.html")]),
+ ])
+ self._run_check('<a title="\u30c6\u30b9\u30c8" '
+ 'href="\u30c6\u30b9\u30c8.html">', [
+ ("starttag", "a", [("title", "\u30c6\u30b9\u30c8"),
+ ("href", "\u30c6\u30b9\u30c8.html")]),
+ ])
+
def test_attr_entity_replacement(self):
self._run_check("""<a b='&amp;&gt;&lt;&quot;&apos;'>""", [
("starttag", "a", [("b", "&><\"'")]),