#NEWLINE# def test_alt_unsafe( self ) : #NEWLINE# #INDENT# 'Potentially unsafe alt content is escaped.' #NEWLINE# unsafe_vals = ( ( 'an"<script>alert()</script>' , 'an&quot;&amp;lt;script&amp;gt;alert()&amp;lt;/script&amp;gt;' ) , ( "an'<script>alert()</script>" , "an'&amp;lt;script&amp;gt;alert()&amp;lt;/script&amp;gt;" ) , ( 'single\'"double' , "single'&quot;double" ) ) #NEWLINE# for ( alt_sent , alt_expected ) in unsafe_vals : #NEWLINE# #INDENT# img = pq_img ( self . p , ( ( '[[Image:test.jpg|alt=' + alt_sent ) + ']]' ) ) #NEWLINE# is_true = str ( img ) . startswith ( ( ( '<img alt="' + alt_expected ) + '"' ) ) #NEWLINE# assert is_true , ( 'Expected "%s", sent "%s"' % ( alt_expected , alt_sent ) )