ox.html.sanitize_html: fix existing tests
The backslashes need to be escaped to come out as literal backslashes in the Python source code run by doctest.
This commit is contained in:
parent
9b887120f7
commit
5448aec902
1 changed files with 3 additions and 3 deletions
|
@ -205,15 +205,15 @@ def sanitize_html(html, tags=None, global_attributes=[]):
|
||||||
>>> sanitize_html('<a href="http://foo.com" onmouseover="alert()">foo</a>')
|
>>> sanitize_html('<a href="http://foo.com" onmouseover="alert()">foo</a>')
|
||||||
u'<a href="http://foo.com">foo</a>'
|
u'<a href="http://foo.com">foo</a>'
|
||||||
>>> sanitize_html('<a href="javascript:alert()">foo</a>')
|
>>> sanitize_html('<a href="javascript:alert()">foo</a>')
|
||||||
u'<a href="javascript:alert()">foo'
|
u'<a href="javascript:alert()">foo</a>'
|
||||||
>>> sanitize_html('[http://foo.com foo]')
|
>>> sanitize_html('[http://foo.com foo]')
|
||||||
u'<a href="http://foo.com">foo</a>'
|
u'<a href="http://foo.com">foo</a>'
|
||||||
>>> sanitize_html('<div style="direction: rtl">foo</div>')
|
>>> sanitize_html('<div style="direction: rtl">foo</div>')
|
||||||
u'<div style="direction: rtl">foo</div>'
|
u'<div style="direction: rtl">foo</div>'
|
||||||
>>> sanitize_html('<script>alert()</script>')
|
>>> sanitize_html('<script>alert()</script>')
|
||||||
u'<script>alert()</script>'
|
u'<script>alert()</script>'
|
||||||
>>> sanitize_html("'foo' < 'bar' && \"foo\" > \"bar\"")
|
>>> sanitize_html("'foo' < 'bar' && \\"foo\\" > \\"bar\\"")
|
||||||
u'\'foo\' < \'bar\' && "foo" > "bar"'
|
u'\\'foo\\' < \\'bar\\' && "foo" > "bar"'
|
||||||
>>> sanitize_html('<b>foo')
|
>>> sanitize_html('<b>foo')
|
||||||
u'<b>foo</b>'
|
u'<b>foo</b>'
|
||||||
>>> sanitize_html('<b>foo</b></b>')
|
>>> sanitize_html('<b>foo</b></b>')
|
||||||
|
|
Loading…
Reference in a new issue