diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2011-04-28 14:08:53 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2011-04-28 14:08:53 +0000 |
| commit | cf11e3789b6643cf451d79d675a97c4de94542b0 (patch) | |
| tree | a1b7c10559f18a1daef2a6d63b75d98c5821d274 /tests | |
| parent | 2ac4f175ec7ec5f6122d079e7f1dbac4800e7657 (diff) | |
Fixed #7267 - UnicodeDecodeError in clean_html
Thanks to Nikolay for the report, and gav and aaugustin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/utils/html.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/regressiontests/utils/html.py b/tests/regressiontests/utils/html.py index 3acb218cd1..d8b9bde8bf 100644 --- a/tests/regressiontests/utils/html.py +++ b/tests/regressiontests/utils/html.py @@ -121,3 +121,15 @@ class TestUtilsHtml(unittest.TestCase): ) for value, output in items: self.check_output(f, value, output) + + def test_clean_html(self): + f = html.clean_html + items = ( + (u'<p>I <i>believe</i> in <b>semantic markup</b>!</p>', u'<p>I <em>believe</em> in <strong>semantic markup</strong>!</p>'), + (u'I escape & I don\'t <a href="#" target="_blank">target</a>', u'I escape & I don\'t <a href="#" >target</a>'), + (u'<p>I kill whitespace</p><br clear="all"><p> </p>', u'<p>I kill whitespace</p>'), + # also a regression test for #7267: this used to raise an UnicodeDecodeError + (u'<p>* foo</p><p>* bar</p>', u'<ul>\n<li> foo</li><li> bar</li>\n</ul>'), + ) + for value, output in items: + self.check_output(f, value, output) |
