<s> import unittest <EOL> from rx import Observable <EOL> from rx . testing import TestScheduler , ReactiveTest , is_prime , MockDisposable <EOL> from rx . disposables import Disposable , SerialDisposable <EOL> on_next = ReactiveTest . on_next <EOL> on_completed = ReactiveTest . on_completed <EOL> on_error = ReactiveTest . on_error <EOL> subscribe = ReactiveTest . subscribe <EOL> subscribed = ReactiveTest . subscribed <EOL> disposed = ReactiveTest . disposed <EOL> created = ReactiveTest . created <EOL> class TestMerge ( unittest . TestCase ) : <EOL> def test_merge_never2 ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> n1 = Observable . never ( ) <EOL> n2 = Observable . never ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , n1 , n2 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( ) <EOL> def test_merge_never3 ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> n1 = Observable . never ( ) <EOL> n2 = Observable . never ( ) <EOL> n3 = Observable . never ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , n1 , n2 , n3 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( ) <EOL> def test_merge_empty2 ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> e1 = Observable . empty ( ) <EOL> e2 = Observable . empty ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , e1 , e2 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_empty3 ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> e1 = Observable . empty ( ) <EOL> e2 = Observable . empty ( ) <EOL> e3 = Observable . empty ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , e1 , e2 , e3 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_empty_delayed2_right_last ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> l_msgs = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> r_msgs = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> e1 = scheduler . create_hot_observable ( l_msgs ) <EOL> e2 = scheduler . create_hot_observable ( r_msgs ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , e1 , e2 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_empty_delayed2_left_last ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> l_msgs = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> r_msgs = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> e1 = scheduler . create_hot_observable ( l_msgs ) <EOL> e2 = scheduler . create_hot_observable ( r_msgs ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , e1 , e2 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_empty_delayed3_middle_last ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> msgs2 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> msgs3 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> e1 = scheduler . create_hot_observable ( msgs1 ) <EOL> e2 = scheduler . create_hot_observable ( msgs2 ) <EOL> e3 = scheduler . create_hot_observable ( msgs3 ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , e1 , e2 , e3 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_empty_never ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> e1 = scheduler . create_hot_observable ( msgs1 ) <EOL> n1 = Observable . never ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , e1 , n1 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( ) <EOL> def test_merge_never_empty ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> e1 = scheduler . create_hot_observable ( msgs1 ) <EOL> n1 = Observable . never ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , n1 , e1 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( ) <EOL> def test_merge_return_never ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_completed ( <NUM_LIT> ) ] <EOL> r1 = scheduler . create_hot_observable ( msgs1 ) <EOL> n1 = Observable . never ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , r1 , n1 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:2> ) ) <EOL> def test_merge_never_return ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_completed ( <NUM_LIT> ) ] <EOL> r1 = scheduler . create_hot_observable ( msgs1 ) <EOL> n1 = Observable . never ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , n1 , r1 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:2> ) ) <EOL> def test_merge_error_never ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_error ( <NUM_LIT> , ex ) ] <EOL> e1 = scheduler . create_hot_observable ( msgs1 ) <EOL> n1 = Observable . never ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , e1 , n1 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> def test_merge_never_error ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_error ( <NUM_LIT> , ex ) ] <EOL> e1 = scheduler . create_hot_observable ( msgs1 ) <EOL> n1 = Observable . never ( ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , n1 , e1 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> def test_merge_empty_return ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> msgs2 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_completed ( <NUM_LIT> ) ] <EOL> e1 = scheduler . create_hot_observable ( msgs1 ) <EOL> r1 = scheduler . create_hot_observable ( msgs2 ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , e1 , r1 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_return_empty ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> msgs2 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_completed ( <NUM_LIT> ) ] <EOL> e1 = scheduler . create_hot_observable ( msgs1 ) <EOL> r1 = scheduler . create_hot_observable ( msgs2 ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , r1 , e1 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_lots2 ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_completed ( <NUM_LIT> ) ] <EOL> msgs2 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_completed ( <NUM_LIT> ) ] <EOL> o1 = scheduler . create_hot_observable ( msgs1 ) <EOL> o2 = scheduler . create_hot_observable ( msgs2 ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , o1 , o2 ) <EOL> results = scheduler . start ( create ) . messages <EOL> assert ( len ( results ) == <NUM_LIT:9> ) <EOL> for i , result in enumerate ( results [ : - <NUM_LIT:1> ] ) : <EOL> assert ( result . value . kind == '<STR_LIT:N>' ) <EOL> assert ( result . time == <NUM_LIT> + i * <NUM_LIT:5> ) <EOL> assert ( result . value . value == i + <NUM_LIT:2> ) <EOL> assert ( results [ <NUM_LIT:8> ] . value . kind == '<STR_LIT:C>' and results [ <NUM_LIT:8> ] . time == <NUM_LIT> ) <EOL> def test_merge_lots3 ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_completed ( <NUM_LIT> ) ] <EOL> msgs2 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_completed ( <NUM_LIT> ) ] <EOL> msgs3 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_completed ( <NUM_LIT> ) ] <EOL> o1 = scheduler . create_hot_observable ( msgs1 ) <EOL> o2 = scheduler . create_hot_observable ( msgs2 ) <EOL> o3 = scheduler . create_hot_observable ( msgs3 ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , o1 , o2 , o3 ) <EOL> results = scheduler . start ( create ) . messages <EOL> assert ( len ( results ) == <NUM_LIT:9> ) <EOL> for i , result in enumerate ( results [ : - <NUM_LIT:1> ] ) : <EOL> assert ( results [ i ] . value . kind == '<STR_LIT:N>' and results [ i ] . time == <NUM_LIT> + i * <NUM_LIT:5> and results [ i ] . value . value == i + <NUM_LIT:2> ) <EOL> assert ( results [ <NUM_LIT:8> ] . value . kind == '<STR_LIT:C>' and results [ <NUM_LIT:8> ] . time == <NUM_LIT> ) <EOL> def test_merge_error_left ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_error ( <NUM_LIT> , ex ) ] <EOL> msgs2 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ] <EOL> o1 = scheduler . create_hot_observable ( msgs1 ) <EOL> o2 = scheduler . create_hot_observable ( msgs2 ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , o1 , o2 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> def test_merge_error_causes_disposal ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> msgs1 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_error ( <NUM_LIT> , ex ) ] <EOL> msgs2 = [ on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ] <EOL> source_not_disposed = [ False ] <EOL> o1 = scheduler . create_hot_observable ( msgs1 ) <EOL> def action ( ) : <EOL> source_not_disposed [ <NUM_LIT:0> ] = True <EOL> o2 = scheduler . create_hot_observable ( msgs2 ) . do_action ( on_next = action ) <EOL> def create ( ) : <EOL> return Observable . merge ( scheduler , o1 , o2 ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_error ( <NUM_LIT> , ex ) ) <EOL> assert ( not source_not_disposed [ <NUM_LIT:0> ] ) <EOL> def test_merge_observable_of_observable_data ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_next ( <NUM_LIT:30> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:50> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_next ( <NUM_LIT:30> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge_observable ( ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_observable_of_observable_data_non_overlapped ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_next ( <NUM_LIT:30> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:50> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_next ( <NUM_LIT:30> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:50> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge_observable ( ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT> ) ) <EOL> def test_merge_observable_of_observable_inner_throws ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_next ( <NUM_LIT:30> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_error ( <NUM_LIT:50> , ex ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_next ( <NUM_LIT:30> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:50> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge_observable ( ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> def test_merge_observable_of_observable_outer_throws ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:20> , <NUM_LIT> ) , on_next ( <NUM_LIT:30> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:50> ) ) ) , on_error ( <NUM_LIT> , ex ) ) <EOL> def create ( ) : <EOL> return xs . merge_observable ( ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> def test_mergeconcat_basic ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , <NUM_LIT:1> ) , on_next ( <NUM_LIT:100> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:20> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_completed ( <NUM_LIT:200> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge ( <NUM_LIT:2> ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> def test_mergeconcat_basic_long ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , <NUM_LIT:1> ) , on_next ( <NUM_LIT:100> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:20> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge ( <NUM_LIT:2> ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> def test_mergeconcat_basic_wide ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , <NUM_LIT:1> ) , on_next ( <NUM_LIT:100> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:20> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge ( <NUM_LIT:3> ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> def test_mergeconcat_basic_late ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , <NUM_LIT:1> ) , on_next ( <NUM_LIT:100> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:20> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge ( <NUM_LIT:3> ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> def test_mergeconcat_disposed ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , <NUM_LIT:1> ) , on_next ( <NUM_LIT:100> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:20> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_completed ( <NUM_LIT:200> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge ( <NUM_LIT:2> ) <EOL> results = scheduler . start ( create , disposed = <NUM_LIT> ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> def test_mergeconcat_outererror ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , <NUM_LIT:1> ) , on_next ( <NUM_LIT:100> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:20> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_completed ( <NUM_LIT:200> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) ) , on_error ( <NUM_LIT> , ex ) ) <EOL> def create ( ) : <EOL> return xs . merge ( <NUM_LIT:2> ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> def test_mergeconcat_innererror ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , <NUM_LIT:1> ) , on_next ( <NUM_LIT:100> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:20> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_completed ( <NUM_LIT:200> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_error ( <NUM_LIT> , ex ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT:9> ) , on_next ( <NUM_LIT> , <NUM_LIT:10> ) , on_completed ( <NUM_LIT> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge ( <NUM_LIT:2> ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:6> ) , on_next ( <NUM_LIT> , <NUM_LIT:7> ) , on_next ( <NUM_LIT> , <NUM_LIT:8> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> def test_merge_112233 ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( <EOL> on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) <EOL> ys = scheduler . create_hot_observable ( <EOL> on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . merge ( ys ) <EOL> results = scheduler . start ( create ) <EOL> results . messages . assert_equal ( <EOL> on_next ( <NUM_LIT> , <NUM_LIT:1> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:1> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) </s>
