#NEWLINE# def test_select_with_index_completed( self ) : #NEWLINE# #INDENT# scheduler = TestScheduler ( ) #NEWLINE# invoked = [ 0 ] #NEWLINE# xs = scheduler . create_hot_observable ( on_next ( 180 , 5 ) , on_next ( 210 , 4 ) , on_next ( 240 , 3 ) , on_next ( 290 , 2 ) , on_next ( 350 , 1 ) , on_completed ( 400 ) , on_next ( 410 , ( - 1 ) ) , on_completed ( 420 ) , on_error ( 430 , 'ex' ) ) #NEWLINE# def factory( ) : #NEWLINE# #INDENT# def projection( x , index ) : #NEWLINE# #INDENT# invoked [ 0 ] += 1 #NEWLINE# return ( ( x + 1 ) + ( index * 10 ) ) #NEWLINE# #UNINDENT# return xs . map ( projection ) #NEWLINE# #UNINDENT# results = scheduler . start ( results ) #NEWLINE# results . messages . assert_equal ( on_next ( 210 , 5 ) , on_next ( 240 , 14 ) , on_next ( 290 , 23 ) , on_next ( 350 , 32 ) , on_completed ( 400 ) ) #NEWLINE# xs . subscriptions . assert_equal ( subscribe ( 200 , 400 ) ) #NEWLINE# assert ( invoked [ 0 ] == 4 )