From 5448aec90298c12ef74956955193cb1aad168406 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Tue, 24 Nov 2015 17:58:39 +0000 Subject: [PATCH] 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. --- ox/html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ox/html.py b/ox/html.py index d63d529..d69c2df 100644 --- a/ox/html.py +++ b/ox/html.py @@ -205,15 +205,15 @@ def sanitize_html(html, tags=None, global_attributes=[]): >>> sanitize_html('foo') u'foo' >>> sanitize_html('foo') - u'<a href="javascript:alert()">foo' + u'<a href="javascript:alert()">foo</a>' >>> sanitize_html('[http://foo.com foo]') u'foo' >>> sanitize_html('
foo
') u'
foo
' >>> sanitize_html('') u'<script>alert()</script>' - >>> sanitize_html("'foo' < 'bar' && \"foo\" > \"bar\"") - u'\'foo\' < \'bar\' && "foo" > "bar"' + >>> sanitize_html("'foo' < 'bar' && \\"foo\\" > \\"bar\\"") + u'\\'foo\\' < \\'bar\\' && "foo" > "bar"' >>> sanitize_html('foo') u'foo' >>> sanitize_html('foo')