<s> import unittest <EOL> from rx . observable import Observable <EOL> from rx . testing import TestScheduler , ReactiveTest , is_prime <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 TestSelectMany ( unittest . TestCase ) : <EOL> def test_select_many_then_complete_complete ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_cold_observable ( on_next ( <NUM_LIT:100> , <NUM_LIT:4> ) , on_next ( <NUM_LIT:200> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ) <EOL> ys = scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT:100> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT:200> , "<STR_LIT>" ) , on_completed ( <NUM_LIT> ) ) <EOL> def factory ( ) : <EOL> return xs . select_many ( ys ) <EOL> results = scheduler . start ( factory ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> ys . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_then_complete_complete_2 ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_cold_observable ( on_next ( <NUM_LIT:100> , <NUM_LIT:4> ) , on_next ( <NUM_LIT:200> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ) <EOL> ys = scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT:100> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT:200> , "<STR_LIT>" ) , on_completed ( <NUM_LIT> ) ) <EOL> def factory ( ) : <EOL> return xs . select_many ( ys ) <EOL> results = scheduler . start ( factory ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> ys . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_then_never_complete ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_cold_observable ( on_next ( <NUM_LIT:100> , <NUM_LIT:4> ) , on_next ( <NUM_LIT:200> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:0> ) ) <EOL> ys = scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT:100> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT:200> , "<STR_LIT>" ) , on_completed ( <NUM_LIT> ) ) <EOL> results = scheduler . start ( lambda : xs . select_many ( ys ) ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT:1000> ) ) <EOL> ys . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT:1000> ) ) <EOL> def test_select_many_then_complete_never ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_cold_observable ( on_next ( <NUM_LIT:100> , <NUM_LIT:4> ) , on_next ( <NUM_LIT:200> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ) <EOL> ys = scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT:100> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT:200> , "<STR_LIT>" ) ) <EOL> results = scheduler . start ( lambda : xs . select_many ( ys ) ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> ys . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT:1000> ) , subscribe ( <NUM_LIT> , <NUM_LIT:1000> ) , subscribe ( <NUM_LIT> , <NUM_LIT:1000> ) , subscribe ( <NUM_LIT> , <NUM_LIT:1000> ) ) <EOL> def test_select_many_then_complete_error ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_cold_observable ( on_next ( <NUM_LIT:100> , <NUM_LIT:4> ) , on_next ( <NUM_LIT:200> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ) <EOL> ys = scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT:100> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT:200> , "<STR_LIT>" ) , on_error ( <NUM_LIT> , ex ) ) <EOL> results = scheduler . start ( lambda : xs . select_many ( ys ) ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_error ( <NUM_LIT> , ex ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> ys . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_then_error_complete ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_cold_observable ( on_next ( <NUM_LIT:100> , <NUM_LIT:4> ) , on_next ( <NUM_LIT:200> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> ys = scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT:100> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT:200> , "<STR_LIT>" ) , on_completed ( <NUM_LIT> ) ) <EOL> results = scheduler . start ( lambda : xs . select_many ( ys ) ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_error ( <NUM_LIT> , ex ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> ys . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_then_error_error ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_cold_observable ( on_next ( <NUM_LIT:100> , <NUM_LIT:4> ) , on_next ( <NUM_LIT:200> , <NUM_LIT:2> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_error ( <NUM_LIT> , ex ) ) <EOL> ys = scheduler . create_cold_observable ( on_next ( <NUM_LIT:50> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT:100> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT:200> , "<STR_LIT>" ) , on_error ( <NUM_LIT> , ex ) ) <EOL> results = scheduler . start ( lambda : xs . select_many ( ys ) ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:foo>" ) , on_next ( <NUM_LIT> , "<STR_LIT>" ) , on_next ( <NUM_LIT> , "<STR_LIT:bar>" ) , on_error ( <NUM_LIT> , ex ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> ys . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) , subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_complete ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT:5> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <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> , <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:50> , <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_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:100> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def factory ( ) : <EOL> return xs . select_many ( lambda x : x ) <EOL> results = scheduler . start ( factory ) <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_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:2> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:3> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:4> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:5> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:6> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_complete_inner_not_complete ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT:5> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <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> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <NUM_LIT> ) , on_next ( <NUM_LIT:50> , <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_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:100> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def factory ( ) : <EOL> return xs . select_many ( lambda x : x ) <EOL> results = scheduler . start ( factory ) <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> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:2> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:3> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT:1000> ) ) <EOL> xs . messages [ <NUM_LIT:4> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:5> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:6> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_complete_outer_not_complete ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT:5> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <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> , <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:50> , <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_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:100> ) ) ) ) <EOL> def factory ( ) : <EOL> return xs . select_many ( lambda x : x ) <EOL> results = scheduler . start ( factory ) <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> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT:1000> ) ) <EOL> xs . messages [ <NUM_LIT:2> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:3> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:4> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:5> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:6> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_error_outer ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT:5> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <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> , <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:50> , <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_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:100> ) ) ) , on_error ( <NUM_LIT> , ex ) ) <EOL> def factory ( ) : <EOL> return xs . select_many ( lambda x : x ) <EOL> results = scheduler . start ( factory ) <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_error ( <NUM_LIT> , ex ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:2> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:3> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:4> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:5> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:6> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> def test_select_many_error_inner ( self ) : <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT:5> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <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 ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( 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:50> , <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_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:100> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def factory ( ) : <EOL> return xs . select_many ( lambda x : x ) <EOL> results = scheduler . start ( factory ) <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_error ( <NUM_LIT> , ex ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:2> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:3> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:4> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:5> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:6> ] . value . value . subscriptions . assert_equal ( ) <EOL> def test_select_many_dispose ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT:5> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <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> , <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:50> , <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_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:100> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def create ( ) : <EOL> return xs . select_many ( lambda x : x ) <EOL> results = scheduler . start ( create , disposed = <NUM_LIT> ) <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> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:2> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:3> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:4> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:5> ] . value . value . subscriptions . assert_equal ( ) <EOL> xs . messages [ <NUM_LIT:6> ] . value . value . subscriptions . assert_equal ( ) <EOL> def test_select_many_throw ( self ) : <EOL> invoked = [ <NUM_LIT:0> ] <EOL> ex = '<STR_LIT>' <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT:5> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_error ( <NUM_LIT:1> , '<STR_LIT>' ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT:10> , <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> , <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:50> , <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_completed ( <NUM_LIT> ) ) ) , on_next ( <NUM_LIT> , scheduler . create_cold_observable ( on_next ( <NUM_LIT> , <NUM_LIT> ) , on_next ( <NUM_LIT> , <NUM_LIT> ) , on_completed ( <NUM_LIT:100> ) ) ) , on_completed ( <NUM_LIT> ) ) <EOL> def factory ( ) : <EOL> def projection ( x ) : <EOL> invoked [ <NUM_LIT:0> ] += <NUM_LIT:1> <EOL> if invoked [ <NUM_LIT:0> ] == <NUM_LIT:3> : <EOL> raise Exception ( ex ) <EOL> return x <EOL> return xs . select_many ( projection ) <EOL> results = scheduler . start ( factory ) <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_error ( <NUM_LIT> , ex ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:2> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:3> ] . value . value . subscriptions . assert_equal ( subscribe ( <NUM_LIT> , <NUM_LIT> ) ) <EOL> xs . messages [ <NUM_LIT:4> ] . value . value . subscriptions . assert_equal ( ) <EOL> xs . messages [ <NUM_LIT:5> ] . value . value . subscriptions . assert_equal ( ) <EOL> xs . messages [ <NUM_LIT:6> ] . value . value . subscriptions . assert_equal ( ) <EOL> def test_select_many_use_function ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_completed ( <NUM_LIT> ) ) <EOL> def factory ( ) : <EOL> def projection ( x ) : <EOL> return Observable . interval ( <NUM_LIT:10> , scheduler ) . map ( lambda a , b : x ) . take ( x ) <EOL> return xs . select_many ( projection ) <EOL> results = scheduler . start ( factory ) <EOL> results . messages . assert_equal ( on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:3> ) , on_next ( <NUM_LIT> , <NUM_LIT:4> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:1> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_next ( <NUM_LIT> , <NUM_LIT:5> ) , on_completed ( <NUM_LIT> ) ) <EOL> xs . subscriptions . assert_equal ( subscribe ( <NUM_LIT:200> , <NUM_LIT> ) ) <EOL> def test_flat_map_iterable_complete ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_completed ( <NUM_LIT> ) <EOL> ) <EOL> inners = [ ] <EOL> def create ( ) : <EOL> def mapper ( x ) : <EOL> ys = [ x ] * x <EOL> inners . append ( ys ) <EOL> return ys <EOL> return xs . flat_map ( mapper ) <EOL> res = scheduler . start ( create ) <EOL> res . messages . assert_equal ( <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_completed ( <NUM_LIT> ) <EOL> ) <EOL> xs . subscriptions . assert_equal ( <EOL> subscribe ( <NUM_LIT:200> , <NUM_LIT> ) <EOL> ) <EOL> assert ( <NUM_LIT:4> == len ( inners ) ) <EOL> def test_flat_map_iterable_complete_result_selector ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_completed ( <NUM_LIT> ) <EOL> ) <EOL> def create ( ) : <EOL> return xs . flat_map ( lambda x , i : [ x ] * x , lambda x , y , i : x + y ) <EOL> res = scheduler . start ( create ) <EOL> res . messages . assert_equal ( <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:8> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:8> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:8> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:8> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:6> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:6> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:6> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_completed ( <NUM_LIT> ) <EOL> ) <EOL> xs . subscriptions . assert_equal ( <EOL> subscribe ( <NUM_LIT:200> , <NUM_LIT> ) <EOL> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
