Example #1
0
    def test_fork_join_never_never(self):
        scheduler = TestScheduler()
        e1 = reactivex.never()
        e2 = reactivex.never()

        results = scheduler.start(lambda: reactivex.fork_join(e1, e2))
        assert results.messages == []
Example #2
0
    def test_amb_never2(self):
        scheduler = TestScheduler()
        l = reactivex.never()
        r = reactivex.never()

        def create():
            return l.pipe(ops.amb(r))

        results = scheduler.start(create)
        assert results.messages == []
Example #3
0
    def test_zip_never_never(self):
        scheduler = TestScheduler()
        o1 = reactivex.never()
        o2 = reactivex.never()

        def create():
            return o1.pipe(ops.zip(o2))

        results = scheduler.start(create)
        assert results.messages == []
Example #4
0
    def test_concat_never_never(self):
        scheduler = TestScheduler()
        e1 = reactivex.never()
        e2 = reactivex.never()

        def create():
            return e1.pipe(ops.concat(e2))

        results = scheduler.start(create)
        assert results.messages == []
Example #5
0
    def test_skip_until_never_never(self):
        scheduler = TestScheduler()
        l = reactivex.never()
        r = reactivex.never()

        def create():
            return l.pipe(ops.skip_until(r))

        results = scheduler.start(create)
        assert results.messages == []
Example #6
0
    def test_merge_never2(self):
        scheduler = TestScheduler()
        n1 = reactivex.never()
        n2 = reactivex.never()

        def create():
            return reactivex.merge(n1, n2)

        results = scheduler.start(create)
        assert results.messages == []
Example #7
0
    def test_take_until_nopreempt_never_never(self):
        scheduler = TestScheduler()
        left = reactivex.never()
        right = reactivex.never()

        def create():
            return left.pipe(ops.take_until(right))

        results = scheduler.start(create)
        assert results.messages == []
Example #8
0
    def test_amb_never3(self):
        scheduler = TestScheduler()
        n1 = reactivex.never()
        n2 = reactivex.never()
        n3 = reactivex.never()

        def create():
            return reactivex.amb(n1, n2, n3)

        results = scheduler.start(create)
        assert results.messages == []
Example #9
0
    def test_with_latest_from_never_never(self):
        scheduler = TestScheduler()
        e1 = reactivex.never()
        e2 = reactivex.never()

        def create():
            return e1.pipe(
                ops.with_latest_from(e2),
                ops.map(sum),
            )

        results = scheduler.start(create)
        assert results.messages == []
Example #10
0
 def test_never_basic(self):
     scheduler = TestScheduler()
     xs = never()
     results = scheduler.create_observer()
     xs.subscribe(results)
     scheduler.start()
     assert results.messages == []
Example #11
0
    def test_fork_join_never_empty(self):
        scheduler = TestScheduler()
        e1 = reactivex.never()
        e2 = reactivex.empty()

        results = scheduler.start(lambda: reactivex.fork_join(e1, e2))
        assert results.messages == [on_completed(200)]
Example #12
0
 def action_create(
     scheduler: abc.SchedulerBase, state: Any = None
 ) -> abc.DisposableBase:
     """Called at create time. Defaults to 100"""
     nonlocal source
     source = create() if create is not None else reactivex.never()
     return Disposable()
Example #13
0
 def test_publish_with_initial_value_multiple_connections(self):
     xs = reactivex.never()
     ys = xs.pipe(ops.publish_value(1979))
     connection1 = ys.connect()
     connection2 = ys.connect()
     assert connection1 == connection2
     connection1.dispose()
     connection2.dispose()
     connection3 = ys.connect()
     assert connection1 != connection3
Example #14
0
    def test_fork_join_never_non_empty(self):
        scheduler = TestScheduler()
        e1 = reactivex.never()
        e2 = scheduler.create_hot_observable(
            [on_next(150, 1),
             on_next(230, 2),
             on_completed(300)])

        results = scheduler.start(lambda: reactivex.fork_join(e1, e2))
        assert results.messages == []
Example #15
0
 def test_replay_time_multiple_connections(self):
     xs = reactivex.never()
     ys = xs.pipe(ops.replay(window=100))
     connection1 = ys.connect()
     connection2 = ys.connect()
     assert connection1 == connection2
     connection1.dispose()
     connection2.dispose()
     connection3 = ys.connect()
     assert connection1 != connection3
Example #16
0
    def test_skip_until_never_next(self):
        scheduler = TestScheduler()
        r_msgs = [on_next(150, 1), on_next(225, 2), on_completed(250)]
        l = reactivex.never()
        r = scheduler.create_hot_observable(r_msgs)

        def create():
            return l.pipe(ops.skip_until(r))

        results = scheduler.start(create)
        assert results.messages == []
Example #17
0
 def test_publish_multipleconnections(self):
     xs = reactivex.never()
     ys = xs.pipe(ops.publish())
     connection1 = ys.connect()
     connection2 = ys.connect()
     assert connection1 == connection2
     connection1.dispose()
     connection2.dispose()
     connection3 = ys.connect()
     assert connection1 != connection3
     connection3.dispose()
Example #18
0
    def test_amb_empty_never(self):
        scheduler = TestScheduler()
        r_msgs = [on_next(150, 1), on_completed(225)]
        n = reactivex.never()
        e = scheduler.create_hot_observable(r_msgs)

        def create():
            return e.pipe(ops.amb(n))

        results = scheduler.start(create)
        assert results.messages == [on_completed(225)]
Example #19
0
    def test_merge_never_return(self):
        scheduler = TestScheduler()
        msgs1 = [on_next(150, 1), on_next(210, 2), on_completed(245)]
        r1 = scheduler.create_hot_observable(msgs1)
        n1 = reactivex.never()

        def create():
            return reactivex.merge(n1, r1)

        results = scheduler.start(create)
        assert results.messages == [on_next(210, 2)]
Example #20
0
    def test_take_until_nopreempt_never_empty(self):
        scheduler = TestScheduler()
        right_msgs = [on_next(150, 1), on_completed(225)]
        left = reactivex.never()
        right = scheduler.create_hot_observable(right_msgs)

        def create():
            return left.pipe(ops.take_until(right))

        results = scheduler.start(create)
        assert results.messages == []
Example #21
0
    def test_concat_never_empty(self):
        scheduler = TestScheduler()
        msgs1 = [on_next(150, 1), on_completed(230)]
        e1 = scheduler.create_hot_observable(msgs1)
        e2 = reactivex.never()

        def create():
            return e2.pipe(ops.concat(e1))

        results = scheduler.start(create)
        assert results.messages == []
Example #22
0
    def test_zip_non_empty_never(self):
        scheduler = TestScheduler()
        msgs = [on_next(150, 1), on_next(215, 2), on_completed(220)]
        e1 = scheduler.create_hot_observable(msgs)
        e2 = reactivex.never()

        def create():
            return e1.pipe(ops.zip(e2), ops.map(sum))

        results = scheduler.start(create)
        assert results.messages == []
Example #23
0
    def test_replay_count_multiple_connections(self):

        xs = reactivex.never()
        ys = xs.pipe(ops.replay(None, 3))
        connection1 = ys.connect()
        connection2 = ys.connect()
        assert connection1 == connection2
        connection1.dispose()
        connection2.dispose()
        connection3 = ys.connect()
        assert connection1 != connection3
Example #24
0
    def test_zip_never_empty(self):
        scheduler = TestScheduler()
        msgs = [on_next(150, 1), on_completed(210)]
        o1 = reactivex.never()
        o2 = scheduler.create_hot_observable(msgs)

        def create():
            return o1.pipe(ops.zip(o2))

        results = scheduler.start(create)
        assert results.messages == [on_completed(210)]
Example #25
0
        def create():
            nonlocal completed

            def on_next(x):
                i[0] += 1

            def on_completed():
                nonlocal completed
                completed = True

            return reactivex.never().pipe(
                _.do_action(on_next=on_next, on_completed=on_completed), )
Example #26
0
    def test_catch_never(self):
        scheduler = TestScheduler()
        msgs2 = [on_next(240, 5), on_completed(250)]
        o1 = reactivex.never()
        o2 = scheduler.create_hot_observable(msgs2)

        def create():
            return o1.pipe(ops.catch(o2))

        results = scheduler.start(create)

        assert results.messages == []
Example #27
0
    def test_zip_error_never(self):
        ex = "ex"
        scheduler = TestScheduler()
        msgs2 = [on_next(150, 1), on_error(220, ex)]
        e1 = reactivex.never()
        e2 = scheduler.create_hot_observable(msgs2)

        def create():
            return e2.pipe(ops.zip(e1), ops.map(sum))

        results = scheduler.start(create)
        assert results.messages == [on_error(220, ex)]
Example #28
0
    def test_merge_never_error(self):
        ex = "ex"
        scheduler = TestScheduler()
        msgs1 = [on_next(150, 1), on_next(210, 2), on_error(245, ex)]
        e1 = scheduler.create_hot_observable(msgs1)
        n1 = reactivex.never()

        def create():
            return reactivex.merge(n1, e1)

        results = scheduler.start(create)
        assert results.messages == [on_next(210, 2), on_error(245, ex)]
Example #29
0
    def test_skip_until_never_error(self):
        ex = "ex"
        scheduler = TestScheduler()
        r_msgs = [on_next(150, 1), on_error(225, ex)]
        l = reactivex.never()
        r = scheduler.create_hot_observable(r_msgs)

        def create():
            return l.pipe(ops.skip_until(r))

        results = scheduler.start(create)
        assert results.messages == [on_error(225, ex)]
Example #30
0
    def test_on_error_resume_next_start_with_never(self):
        scheduler = TestScheduler()
        msgs1 = [on_next(150, 1), on_next(210, 2), on_completed(220)]
        o1 = reactivex.never()
        o2 = scheduler.create_hot_observable(msgs1)

        def create():
            return reactivex.on_error_resume_next(o1, o2)

        results = scheduler.start(create)

        assert results.messages == []