本文整理汇总了Python中rx.disposables.CompositeDisposable.contains方法的典型用法代码示例。如果您正苦于以下问题:Python CompositeDisposable.contains方法的具体用法?Python CompositeDisposable.contains怎么用?Python CompositeDisposable.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.disposables.CompositeDisposable
的用法示例。
在下文中一共展示了CompositeDisposable.contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_groupdisposable_remove
# 需要导入模块: from rx.disposables import CompositeDisposable [as 别名]
# 或者: from rx.disposables.CompositeDisposable import contains [as 别名]
def test_groupdisposable_remove():
disp1 = [False]
disp2 = [False]
def action1():
disp1[0] = True
d1 = Disposable.create(action1)
def action2():
disp2[0] = True
d2 = Disposable.create(action2)
g = CompositeDisposable(d1, d2)
assert g.length == 2
assert g.contains(d1)
assert g.contains(d2)
assert g.remove(d1)
assert g.length == 1
assert not g.contains(d1)
assert g.contains(d2)
assert disp1[0]
assert g.remove(d2)
assert not g.contains(d1)
assert not g.contains(d2)
assert disp2[0]
disp3 = [False]
def action3():
disp3[0] = True
d3 = Disposable.create(action3)
assert not g.remove(d3)
assert not disp3[0]
示例2: test_groupdisposable_add
# 需要导入模块: from rx.disposables import CompositeDisposable [as 别名]
# 或者: from rx.disposables.CompositeDisposable import contains [as 别名]
def test_groupdisposable_add():
d1 = Disposable.empty()
d2 = Disposable.empty()
g = CompositeDisposable(d1)
assert g.length == 1
assert g.contains(d1)
g.add(d2)
assert g.length == 2
assert g.contains(d2)
示例3: test_groupdisposable_remove
# 需要导入模块: from rx.disposables import CompositeDisposable [as 别名]
# 或者: from rx.disposables.CompositeDisposable import contains [as 别名]
def test_groupdisposable_remove():
disp1 = False
disp2 = False
def action1():
nonlocal disp1
disp1 = True
d1 = Disposable(action1)
def action2():
nonlocal disp2
disp2 = True
d2 = Disposable(action2)
g = CompositeDisposable(d1, d2)
assert g.length == 2
assert g.contains(d1)
assert g.contains(d2)
assert g.remove(d1)
assert g.length == 1
assert not g.contains(d1)
assert g.contains(d2)
assert disp1
assert g.remove(d2)
assert not g.contains(d1)
assert not g.contains(d2)
assert disp2
disp3 = False;
def action3():
nonlocal disp3
disp3 = True
d3 = Disposable(action3)
assert not g.remove(d3)
assert not disp3