<s> import unittest <EOL> from rx . observable import Observable <EOL> from rx . testing import TestScheduler , ReactiveTest <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 TestManySelect ( unittest . TestCase ) : <EOL> def test_many_select_law_1 ( self ) : <EOL> xs = Observable . range ( <NUM_LIT:1> , <NUM_LIT:0> ) <EOL> left = xs . many_select ( lambda x : x . first ( ) ) <EOL> right = xs <EOL> left . sequence_equal ( right ) . first ( ) . subscribe ( self . assertTrue ) <EOL> def test_many_select_basic ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> xs = scheduler . create_hot_observable ( <EOL> on_next ( <NUM_LIT:100> , <NUM_LIT:1> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_completed ( <NUM_LIT> ) <EOL> ) <EOL> def create ( ) : <EOL> return xs . many_select ( lambda ys : ys . first ( ) , scheduler ) . merge_all ( ) <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:3> ) , <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> def test_many_select_error ( self ) : <EOL> scheduler = TestScheduler ( ) <EOL> ex = Exception ( ) <EOL> xs = scheduler . create_hot_observable ( <EOL> on_next ( <NUM_LIT:100> , <NUM_LIT:1> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:2> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_error ( <NUM_LIT> , ex ) <EOL> ) <EOL> def create ( ) : <EOL> return xs . many_select ( lambda ys : ys . first ( ) , scheduler ) . merge_all ( ) <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:3> ) , <EOL> on_next ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> on_error ( <NUM_LIT> , ex ) <EOL> ) <EOL> xs . subscriptions . assert_equal ( <EOL> subscribe ( <NUM_LIT:200> , <NUM_LIT> ) <EOL> ) </s>
