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