def test_subscribe_single_flowable(self): reduce_multicast = LoopFlowableMultiCast( source=self.source_multicast, func=lambda m: MultiCast(m).pipe( rxbp.multicast.op.map(lambda t: t[0]), ), initial=[10], ) reduce_multicast.get_source(self.info).subscribe(self.rx_sink) self.source_multicast.on_next(Flowable(self.source1)) sink = TObserver(immediate_continue=0) subscription = self.rx_sink.received[0].unsafe_subscribe( Subscriber( scheduler=self.source_scheduler, subscribe_scheduler=self.source_scheduler, )) subscription.observable.observe(init_observer_info(sink)) self.multicast_scheduler.advance_by(1) self.source_scheduler.advance_by(1) # self.source1.on_next_single(0) print(sink.received) self.assertEqual([10], sink.received)
def op_func(source: MultiCast): # lifted_sources = [source for source in (source, *others) if isinstance(source, LiftIndexMultiCastMixin)] # if 1 < len(lifted_sources): # assert all(lifted_sources[0].lift_index == other.lift_index for other in lifted_sources[1:]), \ # f'layers do not match {[source.lift_index for source in lifted_sources]}' return source.merge(*others)
def op_func(source: MultiCast): def lifted_func(multicast: MultiCastMixin): return func(init_multicast(multicast)) return source.loop_flowables( func=lifted_func, initial=initial, stack=stack, )
def op_func(source: MultiCast): return source.debug( name=name, on_next=on_next, on_completed=on_completed, on_error=on_error, on_subscribe=on_subscribe, on_observe=on_observe, on_dispose=on_dispose, verbose=verbose, stack=stack, )
def test_send_single_flowable(self): reduce_multicast = LoopFlowableMultiCast( source=self.source_multicast, func=lambda m: MultiCast(m).pipe( rxbp.multicast.op.map(lambda t: t[0]), ), initial=[0], ) reduce_multicast.get_source(self.info).subscribe(self.rx_sink) self.source_multicast.on_next(Flowable(self.source1)) self.assertEqual(1, len(self.rx_sink.received))
def op_func(source: MultiCast): return source.flat_map(func=lambda v: v, stack=stack)
def op_func(source: MultiCast): return source.share_func(func=func, stack=stack)
def op_func(source: MultiCast): return source.collect_flowables( stack=stack, maintain_order=maintain_order, )
def op_func(source: MultiCast): return source.map(func=func)
def op_func(source: MultiCast): return source.default_if_empty(lazy_val=lazy_val)
def op_func(source: MultiCast): return source.join_flowables(list(others), stack=stack)
def op_func(source: MultiCast): return source.lift()
def op_func(source: MultiCast): return source.assert_single_subscription(stack=stack)
def op_func(source: MultiCast): return source.filter(predicate=predicate)
def op_func(source: MultiCast): return source.flat_map(func=func, stack=stack)
def op_func(source: MultiCast): return source.first_or_default(lazy_val=lazy_val)
def op_func(source: MultiCast): return source.first(stack=stack)