summaryrefslogtreecommitdiff
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:43:11 +0100
commit6a0291bdaf43e5467a524dcc67f85b55f36fe46f (patch)
treeb1031ea2ffc143f1094e6dde303a72b3b2057f1c
parent6877a9d4156baa3a0c22288c7ef920915b6e1cf8 (diff)
Tweaked strip_tags tests to pass on Python 3.3
-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 70de3a078e..0c6167ef50 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -80,12 +80,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)