def test_futuredisposable_disposebeforeset():
    disposed = [False]

    def dispose():
        disposed[0] = True
    
    d = SingleAssignmentDisposable()
    dd = Disposable(dispose)
    
    assert not disposed[0]
    d.dispose()
    assert not disposed[0]
    d.disposable = dd
    assert d.disposable == None
    assert disposed[0]
    d.dispose()
    assert disposed[0]
dataset/ETHPy150Open ReactiveX/RxPY/tests/test_disposables/test_disposable.py/test_futuredisposable_disposebeforeset/original