#NEWLINE# def test_photo_id_and_format_picked_up_from_context( self ) : #NEWLINE# #INDENT# if ( not redis ) : #NEWLINE# #INDENT# raise SkipTest ( ) #NEWLINE# #UNINDENT# redis . hmset ( ( REDIS_FORMATTED_PHOTO_KEY % ( 42 , self . basic_format . pk ) ) , { #NEWLINE# #INDENT# 'sentinel' : 42 , #NEWLINE# #UNINDENT# } ) #NEWLINE# redis . hmset ( ( REDIS_PHOTO_KEY % 42 ) , { #NEWLINE# #INDENT# 'orig_sentinel' : 42 , #NEWLINE# #UNINDENT# } ) #NEWLINE# c = Context ( { #NEWLINE# #INDENT# 'article' : { #NEWLINE# #INDENT# 'photo_id' : 42 , #NEWLINE# 'photo' : 'not-42' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'image_format' : image_node . basic_format , #NEWLINE# #UNINDENT# } ) #NEWLINE# image_node = _parse_image ( 'image article.photo in image_format as var_name' . split ( ) ) #NEWLINE# tools . assert_true ( isinstance ( image_node , ImageTag ) ) #NEWLINE# tools . assert_equals ( '' , image_node . render ( c ) ) #NEWLINE# tools . assert_true ( ( 'var_name' in c ) ) #NEWLINE# tools . assert_equals ( { #NEWLINE# #INDENT# 'sentinel' : '42' , #NEWLINE# 'original' : { #NEWLINE# #INDENT# 'orig_sentinel' : '42' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } , c [ 'var_name' ] )