summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-03-22 14:41:45 +0100
committerClaude Paroz <claude@2xlibre.net>2014-03-22 14:44:13 +0100
commit07d4b3c8f28eb73bdbf2b1f61990daf01880e46b (patch)
treee8f26d66102d49da1bfe614f1fe7ccd42db34f25 /tests/utils_tests
parent4b725320481b73c2c0e638405e9d5fada32119a0 (diff)
[1.7.x] Tweaked strip_tags tests to pass on Python 3.3
Backport of 6a0291bdaf from master.
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_html.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index 5cf2992ac4..4865652da5 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -82,12 +82,18 @@ class TestUtilsHtml(TestCase):
('a<p a >b</p>c', 'abc'),
('d<a:b c:d>e</p>f', 'def'),
('<strong>foo</strong><a href="http://example.com">bar</a>', 'foobar'),
- ('<sc<!-- -->ript>test<<!-- -->/script>', 'test'),
- ('<script>alert()</script>&h', 'alert()&h'),
)
for value, output in items:
self.check_output(f, value, output)
+ # Some convoluted syntax for which parsing may differ between python versions
+ output = html.strip_tags('<sc<!-- -->ript>test<<!-- -->/script>')
+ self.assertNotIn('<script>', output)
+ self.assertIn('test', output)
+ output = html.strip_tags('<script>alert()</script>&h')
+ self.assertNotIn('<script>', output)
+ self.assertIn('alert()', output)
+
# Test with more lengthy content (also catching performance regressions)
for filename in ('strip_tags1.html', 'strip_tags2.txt'):
path = os.path.join(os.path.dirname(upath(__file__)), 'files', filename)