From f1dc3f2ab2d78ce2bc1a0418239fa6fa1f6c4429 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sat, 7 Apr 2012 13:47:03 +1200 Subject: Integrate lxml for pretty-printing HTML and XML. Tackling the pretty-printing performance problem head-on, at the cost of a major dependency. --- test/test_console_contentview.py | 23 +++++++++++++--- test/test_utils.py | 58 ---------------------------------------- 2 files changed, 20 insertions(+), 61 deletions(-) (limited to 'test') diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py index babe59ea..cf2ab1e5 100644 --- a/test/test_console_contentview.py +++ b/test/test_console_contentview.py @@ -57,15 +57,32 @@ class uContentView(libpry.AutoTree): assert cv.view_urlencoded([], d) assert not cv.view_urlencoded([], "foo") + def test_view_html(self): + s = "


one

" + assert cv.view_html([], s) + + s = "gobbledygook" + assert not cv.view_html([], s) + def test_view_json(self): cv.VIEW_CUTOFF = 100 assert cv.view_json([], "{}") assert not cv.view_urlencoded([], "{") assert cv.view_json([], "[" + ",".join(["0"]*cv.VIEW_CUTOFF) + "]") - def test_view_xmlish(self): - assert cv.view_xmlish([], "") - assert cv.view_xmlish([], "") + def test_view_xml(self): + #assert cv.view_xml([], "") + #assert not cv.view_xml([], "") + + s = """ + + + + """ + print cv.view_xml([], s) def test_view_raw(self): assert cv.view_raw([], "foo") 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"") - assert f(r"") - assert f(r"< body/>") - assert f(r"< body/ >") - assert f(r"< body / >") - assert f(r"") - assert f(r"") - assert f(r"") - assert f(r'') - assert f('') - assert f('