#NEWLINE# def test_stanDirectiveRendering( self ) : #NEWLINE# #INDENT# '\n        Test that a Element with a valid render directive has that directive\n        invoked and the result added to the output.\n        ' #NEWLINE# renders = [ ] #NEWLINE# class RenderfulElement ( Element ) : #NEWLINE# #INDENT# def renderMethod( self , request , tag ) : #NEWLINE# #INDENT# renders . append ( ( self , request ) ) #NEWLINE# return tag [ 'Hello, world.' ] #NEWLINE# #UNINDENT# renderer ( renderMethod ) #NEWLINE# #UNINDENT# request = object ( ) #NEWLINE# element = RenderfulElement ( docFactory = stan ( p ( render = directive ( 'renderMethod' ) ) ) ) #NEWLINE# finished = self . _render ( element , request ) #NEWLINE# def cbFinished( result ) : #NEWLINE# #INDENT# self . assertEqual ( result , '<p>Hello, world.</p>' ) #NEWLINE# self . assertEqual ( renders , [ ( element , request ) ] ) #NEWLINE# #UNINDENT# finished . addCallback ( cbFinished ) #NEWLINE# return renders