<s> from django import template <EOL> from django . utils . unittest import TestCase <EOL> from templatetags import custom <EOL> class CustomFilterTests ( TestCase ) : <EOL> def test_filter ( self ) : <EOL> t = template . Template ( "<STR_LIT>" ) <EOL> self . assertEqual ( <EOL> t . render ( template . Context ( { "<STR_LIT:string>" : "<STR_LIT>" } ) ) , <EOL> u"<STR_LIT>" <EOL> ) <EOL> class CustomTagTests ( TestCase ) : <EOL> def verify_tag ( self , tag , name ) : <EOL> self . assertEqual ( tag . __name__ , name ) <EOL> self . assertEqual ( tag . __doc__ , '<STR_LIT>' % name ) <EOL> self . assertEqual ( tag . __dict__ [ '<STR_LIT>' ] , '<STR_LIT>' % name ) <EOL> def test_simple_tags ( self ) : <EOL> c = template . Context ( { '<STR_LIT:value>' : <NUM_LIT> } ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEqual ( t . render ( c ) , u'<STR_LIT>' ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEqual ( t . render ( c ) , u'<STR_LIT>' ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEqual ( t . render ( c ) , u'<STR_LIT>' ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEqual ( t . render ( c ) , u'<STR_LIT>' ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEqual ( t . render ( c ) , u'<STR_LIT>' ) <EOL> def test_simple_tag_registration ( self ) : <EOL> self . verify_tag ( custom . no_params , '<STR_LIT>' ) <EOL> self . verify_tag ( custom . one_param , '<STR_LIT>' ) <EOL> self . verify_tag ( custom . explicit_no_context , '<STR_LIT>' ) <EOL> self . verify_tag ( custom . no_params_with_context , '<STR_LIT>' ) <EOL> self . verify_tag ( custom . params_and_context , '<STR_LIT>' ) <EOL> def test_simple_tag_missing_context ( self ) : <EOL> def a_simple_tag_without_parameters ( arg ) : <EOL> """<STR_LIT>""" <EOL> return "<STR_LIT>" <EOL> register = template . Library ( ) <EOL> decorator = register . simple_tag ( takes_context = True ) <EOL> self . assertRaises ( template . TemplateSyntaxError , decorator , a_simple_tag_without_parameters ) <EOL> def test_inclusion_tags ( self ) : <EOL> c = template . Context ( { '<STR_LIT:value>' : <NUM_LIT> } ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEquals ( t . render ( c ) , u'<STR_LIT>' ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEquals ( t . render ( c ) , u'<STR_LIT>' ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEquals ( t . render ( c ) , u'<STR_LIT>' ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEquals ( t . render ( c ) , u'<STR_LIT>' ) <EOL> t = template . Template ( '<STR_LIT>' ) <EOL> self . assertEquals ( t . render ( c ) , u'<STR_LIT>' ) <EOL> def test_inclusion_tag_registration ( self ) : <EOL> self . verify_tag ( custom . inclusion_no_params , '<STR_LIT>' ) <EOL> self . verify_tag ( custom . inclusion_one_param , '<STR_LIT>' ) <EOL> self . verify_tag ( custom . inclusion_explicit_no_context , '<STR_LIT>' ) <EOL> self . verify_tag ( custom . inclusion_no_params_with_context , '<STR_LIT>' ) <EOL> self . verify_tag ( custom . inclusion_params_and_context , '<STR_LIT>' ) </s>
