本文整理汇总了Python中rx.core.Observable.range方法的典型用法代码示例。如果您正苦于以下问题:Python Observable.range方法的具体用法?Python Observable.range怎么用?Python Observable.range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.core.Observable
的用法示例。
在下文中一共展示了Observable.range方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_for_each_index_some_data
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import range [as 别名]
def test_for_each_index_some_data(self):
lstX = []
lstI = []
def action(x, i):
lstX.append(x)
lstI.append(i)
Observable.range(10, 10).to_blocking().for_each(action)
assert(lstX == [x for x in range(10, 20)])
assert(lstI == [x for x in range(10)])
示例2: test_for_each_index_on_next_throws
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import range [as 别名]
def test_for_each_index_on_next_throws(self):
ex = Exception()
xs = Observable.range(0, 10)
def action(x, i):
_raise(ex)
self.assertRaises(RxException, lambda: xs.to_blocking().for_each(action))
示例3: test_many_select_law_1
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import range [as 别名]
def test_many_select_law_1(self):
xs = Observable.range(1, 0)
left = xs.many_select(lambda x: x.first())
right = xs
left.sequence_equal(right).first().subscribe(self.assertTrue)
示例4: go
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import range [as 别名]
async def go():
scheduler = AsyncIOScheduler()
async for x in Observable.range(0, 10, scheduler=scheduler):
print("got %s" % x)
示例5: test_for_each_on_next_throws
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import range [as 别名]
def test_for_each_on_next_throws(self):
ex = Exception()
xs = Observable.range(0, 10)
self.assertRaises(RxException, lambda: xs.to_blocking().for_each(lambda x: _raise(ex)))
示例6: test_for_each_some_data
# 需要导入模块: from rx.core import Observable [as 别名]
# 或者: from rx.core.Observable import range [as 别名]
def test_for_each_some_data(self):
lstX = []
Observable.range(10, 10).to_blocking().for_each(lambda x: lstX.append(x))
assert(lstX == [x for x in range(10, 20)])