Skip to content
Browse files

[1.7.x] Tweaked strip_tags tests to pass on Python 3.3

Backport of 6a0291b from master.
  • Loading branch information...
1 parent 4b72532 commit 07d4b3c8f28eb73bdbf2b1f61990daf01880e46b @claudep claudep committed
Showing with 8 additions and 2 deletions.
  1. +8 −2 tests/utils_tests/
10 tests/utils_tests/
@@ -82,12 +82,18 @@ def test_strip_tags(self):
('a<p a >b</p>c', 'abc'),
('d<a:b c:d>e</p>f', 'def'),
('<strong>foo</strong><a href="">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)

0 comments on commit 07d4b3c

Please sign in to comment.
Something went wrong with that request. Please try again.