示例#1
0
    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)
示例#2
0
    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)
示例#3
0
    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,
        )
示例#4
0
 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,
     )
示例#5
0
    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))
示例#6
0
 def op_func(source: MultiCast):
     return source.flat_map(func=lambda v: v, stack=stack)
示例#7
0
 def op_func(source: MultiCast):
     return source.share_func(func=func, stack=stack)
示例#8
0
 def op_func(source: MultiCast):
     return source.collect_flowables(
         stack=stack,
         maintain_order=maintain_order,
     )
示例#9
0
 def op_func(source: MultiCast):
     return source.map(func=func)
示例#10
0
 def op_func(source: MultiCast):
     return source.default_if_empty(lazy_val=lazy_val)
示例#11
0
 def op_func(source: MultiCast):
     return source.join_flowables(list(others), stack=stack)
示例#12
0
 def op_func(source: MultiCast):
     return source.lift()
示例#13
0
 def op_func(source: MultiCast):
     return source.assert_single_subscription(stack=stack)
示例#14
0
 def op_func(source: MultiCast):
     return source.filter(predicate=predicate)
示例#15
0
 def op_func(source: MultiCast):
     return source.flat_map(func=func, stack=stack)
示例#16
0
 def op_func(source: MultiCast):
     return source.first_or_default(lazy_val=lazy_val)
示例#17
0
 def op_func(source: MultiCast):
     return source.first(stack=stack)