diff options
Diffstat (limited to 'test/test_utils.py')
-rw-r--r-- | test/test_utils.py | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index e445614a..f279ce65 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -58,63 +58,6 @@ class uData(libpry.AutoTree): libpry.raises("does not exist", utils.pkg_data.path, "nonexistent") - -class upretty_xmlish(libpry.AutoTree): - def test_tagre(self): - def f(s): - return re.search(utils.TAG, s, re.VERBOSE|re.MULTILINE) - assert f(r"<body>") - assert f(r"<body/>") - assert f(r"< body/>") - assert f(r"< body/ >") - assert f(r"< body / >") - assert f(r"<foo a=b>") - assert f(r"<foo a='b'>") - assert f(r"<foo a='b\"'>") - assert f(r'<a b=(a.b) href="foo">') - assert f('<td width=25%>') - assert f('<form name="search" action="/search.php" method="get" accept-charset="utf-8" class="search">') - assert f('<img src="gif" width="125" height="16" alt="" />') - - - def test_all(self): - def isbalanced(ret): - # The last tag should have no indent - assert ret[-1].strip() == ret[-1] - - s = "<html><br><br></br><p>one</p></html>" - ret = utils.pretty_xmlish(s) - isbalanced(ret) - - s = r""" -<body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="document.f.q.focus();if(document.images)new Image().src='/images/srpr/nav_logo27.png'" ><textarea id=csi style=display:none></textarea></body> - """ - isbalanced(utils.pretty_xmlish(textwrap.dedent(s))) - - s = r""" - <a href="http://foo.com" target=""> - <img src="http://foo.gif" alt="bar" height="25" width="132"> - </a> - """ - isbalanced(utils.pretty_xmlish(textwrap.dedent(s))) - - s = r""" - <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" - \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> - <html></html> - """ - ret = utils.pretty_xmlish(textwrap.dedent(s)) - isbalanced(ret) - - s = "<html><br/><p>one</p></html>" - ret = utils.pretty_xmlish(s) - assert len(ret) == 6 - isbalanced(ret) - - s = "gobbledygook" - assert utils.pretty_xmlish(s) == ["gobbledygook"] - - class upretty_json(libpry.AutoTree): def test_one(self): s = json.dumps({"foo": 1}) @@ -242,7 +185,6 @@ tests = [ uhexdump(), upretty_size(), uData(), - upretty_xmlish(), upretty_json(), u_urldecode(), udel_all(), |