diff options
| author | Ezio Melotti <ezio.melotti@gmail.com> | 2011-11-01 12:14:15 (GMT) |
|---|---|---|
| committer | Ezio Melotti <ezio.melotti@gmail.com> | 2011-11-01 12:14:15 (GMT) |
| commit | 7903913fa6a2904159cc1658f3471d2d2edde112 (patch) | |
| tree | 05c10516acbf0f93e928d35e66e79a6d06e2408c /Lib/test/test_htmlparser.py | |
| parent | 49ce06858b51ef98c31431436b28d32dd3bd99cd (diff) | |
| parent | 7de56f6a04ab60010b3e2185752b3ddf681d068d (diff) | |
| download | cpython-7903913fa6a2904159cc1658f3471d2d2edde112.zip cpython-7903913fa6a2904159cc1658f3471d2d2edde112.tar.gz cpython-7903913fa6a2904159cc1658f3471d2d2edde112.tar.bz2 | |
#670664: merge with 3.2.
Diffstat (limited to 'Lib/test/test_htmlparser.py')
| -rw-r--r-- | Lib/test/test_htmlparser.py | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/Lib/test/test_htmlparser.py b/Lib/test/test_htmlparser.py index 9664485..fd8447c 100644 --- a/Lib/test/test_htmlparser.py +++ b/Lib/test/test_htmlparser.py @@ -321,18 +321,36 @@ DOCTYPE html [ ("starttag_text", s)]) def test_cdata_content(self): - s = """<script> <!-- not a comment --> ¬-an-entity-ref; </script>""" - self._run_check(s, [ - ("starttag", "script", []), - ("data", " <!-- not a comment --> ¬-an-entity-ref; "), - ("endtag", "script"), - ]) - s = """<script> <not a='start tag'> </script>""" - self._run_check(s, [ - ("starttag", "script", []), - ("data", " <not a='start tag'> "), - ("endtag", "script"), - ]) + contents = [ + '<!-- not a comment --> ¬-an-entity-ref;', + "<not a='start tag'>", + '<a href="" /> <p> <span></span>', + 'foo = "</scr" + "ipt>";', + 'foo = "</SCRIPT" + ">";', + 'foo = <\n/script> ', + '<!-- document.write("</scr" + "ipt>"); -->', + ('\n//<![CDATA[\n' + 'document.write(\'<s\'+\'cript type="text/javascript" ' + 'src="http://www.example.org/r=\'+new ' + 'Date().getTime()+\'"><\\/s\'+\'cript>\');\n//]]>'), + '\n<!-- //\nvar foo = 3.14;\n// -->\n', + 'foo = "</sty" + "le>";', + '<!-- \u2603 -->', + # these two should be invalid according to the HTML 5 spec, + # section 8.1.2.2 + #'foo = </\nscript>', + #'foo = </ script>', + ] + elements = ['script', 'style', 'SCRIPT', 'STYLE', 'Script', 'Style'] + for content in contents: + for element in elements: + element_lower = element.lower() + s = '<{element}>{content}</{element}>'.format(element=element, + content=content) + self._run_check(s, [("starttag", element_lower, []), + ("data", content), + ("endtag", element_lower)]) + def test_entityrefs_in_attributes(self): self._run_check("<html foo='€&aa&unsupported;'>", [ |
