コード例 #1
0
ファイル: test_create.py プロジェクト: mvschaik/RxPY
    def test_create_with_disposable_observer_throws(self):
        def subscribe1(o):
            o.on_next(1)
            return Disposable.empty()

        def on_next(x):
            _raise('ex')

        try:
            return Observable.create_with_disposable(subscribe1).subscribe(on_next)
        except RxException:
            pass
        
        def subscribe2(o):
            o.on_error('exception')
            return Disposable.empty()

        try:
            return Observable.create_with_disposable(subscribe2).subscribe(on_error=lambda ex: _raise('ex'))
        except RxException:
            pass
        
        def subscribe3(o):
            o.on_completed()
            return Disposable.empty()

        try:
            return Observable.create_with_disposable(subscribe3).subscribe(on_completed=_raise('ex'))
        except RxException:
            pass
コード例 #2
0
def test_create_with_disposable_observer_throws():
    def subscribe1(o):
        o.on_next(1)
        return Disposable.empty()

    def on_next(x):
        _raise('ex')

    try:
        return Observable.create_with_disposable(subscribe1).subscribe(on_next)
    except RxException:
        pass

    def subscribe2(o):
        o.on_error('exception')
        return Disposable.empty()

    try:
        return Observable.create_with_disposable(subscribe2).subscribe(
            on_error=lambda ex: _raise('ex'))
    except RxException:
        pass

    def subscribe3(o):
        o.on_completed()
        return Disposable.empty()

    try:
        return Observable.create_with_disposable(subscribe3).subscribe(
            on_completed=_raise('ex'))
    except RxException:
        pass
コード例 #3
0
ファイル: test_create.py プロジェクト: mvschaik/RxPY
        def create():
            def subscribe(o):
                d = BooleanDisposable()
                o.on_next(1)
                o.on_next(2)

                def action1(scheduler, state):
                    if not d.is_disposed:
                        o.on_next(3)
                scheduler.schedule_relative(600, action1)
                
                def action2(scheduler, state):
                    if not d.is_disposed:
                        o.on_next(4)
                scheduler.schedule_relative(700, action2)

                def action3(scheduler, state):
                    if not d.is_disposed:
                        o.on_next(5)
                scheduler.schedule_relative(900, action3)
                
                def action4(scheduler, state):
                    if not d.is_disposed:
                        o.on_next(6)
                scheduler.schedule_relative(1100, action4)
                
                return d
            return Observable.create_with_disposable(subscribe)
コード例 #4
0
ファイル: test_create.py プロジェクト: michaelandersen/RxPY
        def create():
            def subscribe(o):
                o.on_next(1)
                o.on_next(2)
                return Disposable.empty()

            return Observable.create_with_disposable(subscribe)
コード例 #5
0
    def create():
        def subscribe(o):
            d = BooleanDisposable()
            o.on_next(1)
            o.on_next(2)

            def action1(scheduler, state):
                if not d.is_disposed:
                    o.on_next(3)

            scheduler.schedule_relative(600, action1)

            def action2(scheduler, state):
                if not d.is_disposed:
                    o.on_next(4)

            scheduler.schedule_relative(700, action2)

            def action3(scheduler, state):
                if not d.is_disposed:
                    o.on_next(5)

            scheduler.schedule_relative(900, action3)

            def action4(scheduler, state):
                if not d.is_disposed:
                    o.on_next(6)

            scheduler.schedule_relative(1100, action4)

            return d

        return Observable.create_with_disposable(subscribe)
コード例 #6
0
    def create():
        def subscribe(o):
            o.on_next(1)
            o.on_next(2)
            return Disposable.empty()

        return Observable.create_with_disposable(subscribe)
コード例 #7
0
ファイル: test_create.py プロジェクト: mvschaik/RxPY
 def create():
     def subscribe(o):
         o.on_completed()
         o.on_next(100)
         o.on_error('ex')
         o.on_completed()
         return Disposable.empty()
     return Observable.create_with_disposable(subscribe)
コード例 #8
0
    def create():
        def subscribe(o):
            o.on_error(ex)
            o.on_next(100)
            o.on_error('foo')
            o.on_completed()
            return Disposable.empty()

        return Observable.create_with_disposable(subscribe)
コード例 #9
0
ファイル: test_create.py プロジェクト: zorosteven/RxPY
    def test_create_with_disposable_observer_throws(self):
        def subscribe1(o):
            o.on_next(1)
            return Disposable.empty()

        def on_next(x):
            _raise('ex')

        with self.assertRaises(RxException):
            Observable.create_with_disposable(subscribe1).subscribe(on_next)

        def subscribe2(o):
            o.on_error('exception')
            return Disposable.empty()

        with self.assertRaises(RxException):
            Observable.create_with_disposable(subscribe2).subscribe(
                on_error=lambda ex: _raise('ex'))

        def subscribe3(o):
            o.on_completed()
            return Disposable.empty()

        with self.assertRaises(RxException):
            Observable.create_with_disposable(subscribe3).subscribe(
                on_completed=_raise('ex'))
コード例 #10
0
ファイル: test_create.py プロジェクト: michaelandersen/RxPY
    def test_create_with_disposable_observer_throws(self):
        def subscribe1(o):
            o.on_next(1)
            return Disposable.empty()

        def on_next(x):
            _raise("ex")

        with self.assertRaises(RxException):
            Observable.create_with_disposable(subscribe1).subscribe(on_next)

        def subscribe2(o):
            o.on_error("exception")
            return Disposable.empty()

        with self.assertRaises(RxException):
            Observable.create_with_disposable(subscribe2).subscribe(on_error=lambda ex: _raise("ex"))

        def subscribe3(o):
            o.on_completed()
            return Disposable.empty()

        with self.assertRaises(RxException):
            Observable.create_with_disposable(subscribe3).subscribe(on_completed=_raise("ex"))
コード例 #11
0
ファイル: test_create.py プロジェクト: mvschaik/RxPY
 def test_create_with_disposable_exception(self):
     try:
         return Observable.create_with_disposable(lambda: o, _raise('ex')).subscribe()
     except RxException:
         pass
コード例 #12
0
ファイル: test_create.py プロジェクト: michaelandersen/RxPY
 def test_create_with_disposable_exception(self):
     with self.assertRaises(RxException):
         Observable.create_with_disposable(lambda: o, _raise("ex")).subscribe()
コード例 #13
0
def test_create_with_disposable_exception():
    try:
        return Observable.create_with_disposable(lambda: o,
                                                 _raise('ex')).subscribe()
    except RxException:
        pass
コード例 #14
0
ファイル: test_create.py プロジェクト: zorosteven/RxPY
 def test_create_with_disposable_exception(self):
     with self.assertRaises(RxException):
         Observable.create_with_disposable(lambda: o,
                                           _raise('ex')).subscribe()