#NEWLINE# def test_finite( ) : #NEWLINE# #INDENT# scheduler = TestScheduler ( ) #NEWLINE# xs = scheduler . create_hot_observable ( on_next ( 70 , 1 ) , on_next ( 110 , 2 ) , on_next ( 220 , 3 ) , on_next ( 270 , 4 ) , on_next ( 340 , 5 ) , on_next ( 410 , 6 ) , on_next ( 520 , 7 ) , on_completed ( 630 ) , on_next ( 640 , 9 ) , on_completed ( 650 ) , on_error ( 660 , RxException ( ) ) ) #NEWLINE# subject = [ None ] #NEWLINE# subscription = [ None ] #NEWLINE# subscription1 = [ None ] #NEWLINE# subscription2 = [ None ] #NEWLINE# subscription3 = [ None ] #NEWLINE# results1 = scheduler . create_observer ( ) #NEWLINE# results2 = scheduler . create_observer ( ) #NEWLINE# results3 = scheduler . create_observer ( ) #NEWLINE# def action1( scheduler , state = None ) : #NEWLINE# #INDENT# subject [ 0 ] = BehaviorSubject ( 100 ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 100 , action1 ) #NEWLINE# def action2( scheduler , state = None ) : #NEWLINE# #INDENT# subscription [ 0 ] = xs . subscribe ( subject [ 0 ] ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 200 , action2 ) #NEWLINE# def action3( scheduler , state = None ) : #NEWLINE# #INDENT# subscription [ 0 ] . dispose ( ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 1000 , action3 ) #NEWLINE# def action4( scheduler , state = None ) : #NEWLINE# #INDENT# subscription1 [ 0 ] = subject [ 0 ] . subscribe ( results1 ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 300 , action4 ) #NEWLINE# def action5( scheduler , state = None ) : #NEWLINE# #INDENT# subscription2 [ 0 ] = subject [ 0 ] . subscribe ( results2 ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 400 , action5 ) #NEWLINE# def action6( scheduler , state = None ) : #NEWLINE# #INDENT# subscription3 [ 0 ] = subject [ 0 ] . subscribe ( results3 ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 900 , action6 ) #NEWLINE# def action7( scheduler , state = None ) : #NEWLINE# #INDENT# subscription1 [ 0 ] . dispose ( ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 600 , action7 ) #NEWLINE# def action8( scheduler , state = None ) : #NEWLINE# #INDENT# subscription2 [ 0 ] . dispose ( ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 700 , action8 ) #NEWLINE# def action9( scheduler , state = None ) : #NEWLINE# #INDENT# subscription1 [ 0 ] . dispose ( ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 800 , action9 ) #NEWLINE# def action10( scheduler , state = None ) : #NEWLINE# #INDENT# subscription3 [ 0 ] . dispose ( ) #NEWLINE# #UNINDENT# scheduler . schedule_absolute ( 950 , action10 ) #NEWLINE# scheduler . start ( ) #NEWLINE# results1 . messages . assert_equal ( on_next ( 300 , 4 ) , on_next ( 340 , 5 ) , on_next ( 410 , 6 ) , on_next ( 520 , 7 ) ) #NEWLINE# results2 . messages . assert_equal ( on_next ( 400 , 5 ) , on_next ( 410 , 6 ) , on_next ( 520 , 7 ) , on_completed ( 630 ) ) #NEWLINE# results3 . messages . assert_equal ( on_completed ( 900 ) )