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
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
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)
def create(): def subscribe(o): o.on_next(1) o.on_next(2) return Disposable.empty() return Observable.create_with_disposable(subscribe)
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)
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)
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'))
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"))
def test_create_with_disposable_exception(self): try: return Observable.create_with_disposable(lambda: o, _raise('ex')).subscribe() except RxException: pass
def test_create_with_disposable_exception(self): with self.assertRaises(RxException): Observable.create_with_disposable(lambda: o, _raise("ex")).subscribe()
def test_create_with_disposable_exception(): try: return Observable.create_with_disposable(lambda: o, _raise('ex')).subscribe() except RxException: pass
def test_create_with_disposable_exception(self): with self.assertRaises(RxException): Observable.create_with_disposable(lambda: o, _raise('ex')).subscribe()