当前位置: 首页>>代码示例>>Python>>正文


Python Observable.empty方法代码示例

本文整理汇总了Python中rx.core.Observable.empty方法的典型用法代码示例。如果您正苦于以下问题:Python Observable.empty方法的具体用法?Python Observable.empty怎么用?Python Observable.empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rx.core.Observable的用法示例。


在下文中一共展示了Observable.empty方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_empty_observer_throw_exception

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
    def test_empty_observer_throw_exception(self):
        scheduler = TestScheduler()
        xs = Observable.empty(scheduler)
        xs.subscribe(lambda x: None, lambda ex: None, lambda: _raise('ex'))

        with self.assertRaises(RxException):
            scheduler.start()
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:9,代码来源:test_empty.py

示例2: test_select_throws

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
    def test_select_throws(self):
        with self.assertRaises(RxException):
            Observable.return_value(1) \
                .map(lambda x, y: x) \
                .subscribe(lambda x: _raise("ex"))

        with self.assertRaises(RxException):
            Observable.throw_exception('ex') \
                .map(lambda x, y: x) \
                .subscribe(on_error=lambda ex: _raise(ex))

        with self.assertRaises(RxException):
            Observable.empty() \
                .map(lambda x, y: x) \
                .subscribe(lambda x: x, lambda ex: ex, lambda: _raise('ex'))

        def subscribe(observer):
            _raise('ex')

        with self.assertRaises(RxException):
            Observable.create(subscribe) \
                .map(lambda x: x) \
                .subscribe()
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:25,代码来源:test_select.py

示例3: test_select_with_index_throws

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
    def test_select_with_index_throws(self):
        with self.assertRaises(RxException):
            return Observable.return_value(1) \
                .map(lambda x, index: x) \
                .subscribe(lambda x: _raise('ex'))

        with self.assertRaises(RxException):
            return Observable.throw_exception('ex') \
                .map(lambda x, index: x) \
                .subscribe(lambda x: x, lambda ex: _raise(ex))

        with self.assertRaises(RxException):
            return Observable.empty() \
                .map(lambda x, index: x) \
                .subscribe(lambda x: x, lambda ex: _, lambda : _raise('ex'))

        with self.assertRaises(RxException):
            return Observable.create(lambda o: _raise('ex')) \
                .map(lambda x, index: x) \
                .subscribe()
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:22,代码来源:test_select.py

示例4: test_For_each_index_empty

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
 def test_For_each_index_empty(self):
     lstX = []
     Observable.empty().to_blocking().for_each(lambda x, i: lstX.append(x))
     assert(lstX == [])
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:6,代码来源:test_foreach.py

示例5: test_for_each_empty

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
 def test_for_each_empty(self):
     lst = []
     Observable.empty().to_blocking().for_each(lambda x: lst.append(x))
     assert(lst == [])
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:6,代码来源:test_foreach.py

示例6: selector

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
 def selector(_):
     return Observable.empty()
开发者ID:JohnWowUs,项目名称:RxPY,代码行数:4,代码来源:delaysubscription.py

示例7: create

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
 def create():
     return Observable.empty(scheduler).time_interval(scheduler)
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:4,代码来源:test_timeinterval.py

示例8: on_completed

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
 def on_completed(self):
     self.on_next(Observable.empty())
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:4,代码来源:manyselect.py

示例9: factory

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
 def factory():
     return Observable.empty(scheduler)
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:4,代码来源:test_empty.py

示例10: test_as_observable_hides

# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import empty [as 别名]
 def test_as_observable_hides(self):
     some_observable = Observable.empty()
     assert(some_observable.as_observable() != some_observable)
开发者ID:ESSL-CQQ,项目名称:RxPY,代码行数:5,代码来源:test_asobservable.py


注:本文中的rx.core.Observable.empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。