#NEWLINE# def test_template_rendered( ) : #NEWLINE# #INDENT# app = flask . Flask ( __name__ ) #NEWLINE# @ app . route ( '/' ) #NEWLINE# def index( ) : #NEWLINE# #INDENT# return flask . render_template ( 'simple_template.html' , whiskey = 42 ) #NEWLINE# #UNINDENT# recorded = [ ] #NEWLINE# def record( sender , template , context ) : #NEWLINE# #INDENT# recorded . append ( ( template , context ) ) #NEWLINE# #UNINDENT# flask . template_rendered . connect ( record , app ) #NEWLINE# try : #NEWLINE# #INDENT# app . test_client ( ) . get ( '/' ) #NEWLINE# assert ( len ( recorded ) == 1 ) #NEWLINE# ( template , context ) = recorded [ 0 ] #NEWLINE# assert ( template . name == 'simple_template.html' ) #NEWLINE# assert ( context [ 'whiskey' ] == 42 ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# flask . template_rendered . disconnect ( record , app )