#NEWLINE# def test_do_not_call_and_alters_data( self ) : #NEWLINE# #INDENT# class Doodad ( object ) : #NEWLINE# #INDENT# do_not_call_in_templates = True #NEWLINE# alters_data = True #NEWLINE# def __init__( self , value ) : #NEWLINE# #INDENT# self . num_calls = 0 #NEWLINE# self . value = value #NEWLINE# #UNINDENT# def __call__( self ) : #NEWLINE# #INDENT# self . num_calls += 1 #NEWLINE# return { #NEWLINE# #INDENT# 'the_value' : self . value , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# #UNINDENT# my_doodad = Doodad ( 42 ) #NEWLINE# c = template . Context ( { #NEWLINE# #INDENT# 'my_doodad' : my_doodad , #NEWLINE# #UNINDENT# } ) #NEWLINE# t = template . Template ( '{{ my_doodad.value }}' ) #NEWLINE# self . assertEqual ( t . render ( c ) , '42' ) #NEWLINE# t = template . Template ( '{{ my_doodad.the_value }}' ) #NEWLINE# self . assertEqual ( t . render ( c ) , '' ) #NEWLINE# self . assertEqual ( my_doodad . num_calls , 0 )