#NEWLINE# def test_truncate_purified_field_xss( ) : #NEWLINE# #INDENT# 'Truncating should not introduce xss issues.' #NEWLINE# s = 'safe <script>alert("omg")</script>' #NEWLINE# t = PurifiedTranslation ( localized_string = s ) #NEWLINE# env = jingo . get_env ( ) #NEWLINE# actual = env . from_string ( '{{ s|truncate(100) }}' ) . render ( { #NEWLINE# #INDENT# 's' : t , #NEWLINE# #UNINDENT# } ) #NEWLINE# eq_ ( t , 'safe &lt;script&gt;alert("omg")&lt;/script&gt;' ) #NEWLINE# actual = env . from_string ( '{{ s|truncate(5) }}' ) . render ( { #NEWLINE# #INDENT# 's' : t , #NEWLINE# #UNINDENT# } ) #NEWLINE# eq_ ( actual , 'safe ...' )