<s> from django . template . defaultfilters import escape <EOL> from django . test import SimpleTestCase <EOL> from django . utils import six <EOL> from django . utils . functional import Promise , lazy <EOL> from django . utils . safestring import mark_safe <EOL> from . . utils import setup <EOL> class EscapeTests ( SimpleTestCase ) : <EOL> """<STR_LIT>""" <EOL> @ setup ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> def test_escape01 ( self ) : <EOL> output = self . engine . render_to_string ( '<STR_LIT>' , { "<STR_LIT:a>" : "<STR_LIT>" , "<STR_LIT:b>" : mark_safe ( "<STR_LIT>" ) } ) <EOL> self . assertEqual ( output , "<STR_LIT>" ) <EOL> @ setup ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> def test_escape02 ( self ) : <EOL> output = self . engine . render_to_string ( '<STR_LIT>' , { "<STR_LIT:a>" : "<STR_LIT>" , "<STR_LIT:b>" : mark_safe ( "<STR_LIT>" ) } ) <EOL> self . assertEqual ( output , "<STR_LIT>" ) <EOL> @ setup ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> def test_escape03 ( self ) : <EOL> output = self . engine . render_to_string ( '<STR_LIT>' , { "<STR_LIT:a>" : "<STR_LIT>" } ) <EOL> self . assertEqual ( output , "<STR_LIT>" ) <EOL> @ setup ( { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> def test_escape04 ( self ) : <EOL> output = self . engine . render_to_string ( '<STR_LIT>' , { "<STR_LIT:a>" : "<STR_LIT>" } ) <EOL> self . assertEqual ( output , "<STR_LIT>" ) <EOL> def test_escape_lazy_string ( self ) : <EOL> add_html = lazy ( lambda string : string + '<STR_LIT>' , six . text_type ) <EOL> escaped = escape ( add_html ( '<STR_LIT>' ) ) <EOL> self . assertIsInstance ( escaped , Promise ) <EOL> self . assertEqual ( escaped , '<STR_LIT>' ) <EOL> class FunctionTests ( SimpleTestCase ) : <EOL> def test_non_string_input ( self ) : <EOL> self . assertEqual ( escape ( <NUM_LIT> ) , '<STR_LIT>' ) </s>
