#NEWLINE# def test_client_session_periodic_async_added_before_push( self ) : #NEWLINE# #INDENT# application = Application ( ) #NEWLINE# with ManagedServerLoop ( application ) as server : #NEWLINE# #INDENT# doc = document . Document ( ) #NEWLINE# result = DictModel ( ) #NEWLINE# doc . add_root ( result ) #NEWLINE# @ gen . coroutine #NEWLINE# def cb( ) : #NEWLINE# #INDENT# result . values [ 'a' ] = 0 #NEWLINE# result . values [ 'b' ] = ( yield self . async_value ( 1 ) ) #NEWLINE# result . values [ 'c' ] = ( yield self . async_value ( 2 ) ) #NEWLINE# result . values [ 'd' ] = ( yield self . async_value ( 3 ) ) #NEWLINE# result . values [ 'e' ] = ( yield self . async_value ( 4 ) ) #NEWLINE# client_session . close ( ) #NEWLINE# raise gen . Return ( 5 ) #NEWLINE# #UNINDENT# callback = doc . add_periodic_callback ( cb , 10 ) #NEWLINE# client_session = push_session ( doc , session_id = 'test_client_session_periodic_async' , url = url ( server ) , io_loop = server . io_loop ) #NEWLINE# client_session . loop_until_closed ( ) #NEWLINE# doc . remove_periodic_callback ( cb ) #NEWLINE# self . assertDictEqual ( dict ( a = 0 , b = 1 , c = 2 , d = 3 , e = 4 ) , result . values )