def test_refcountdisposable_singlereference(): d = BooleanDisposable() r = RefCountDisposable(d) assert not d.is_disposed r.dispose() assert d.is_disposed r.dispose() assert d.is_disposed
def test_refcountdisposable_primarydisposesfirst(): d = BooleanDisposable() r = RefCountDisposable(d) assert not d.is_disposed d1 = r.disposable d2 = r.disposable assert not d.is_disposed d1.dispose() assert not d.is_disposed r.dispose() assert not d.is_disposed d2.dispose() assert d.is_disposed
def test_refcountdisposable_primarydisposesfirst(): d = BooleanDisposable() r = RefCountDisposable(d) assert not d.is_disposed; d1 = r.disposable d2 = r.disposable assert not d.is_disposed d1.dispose() assert not d.is_disposed r.dispose() assert not d.is_disposed d2.dispose() assert d.is_disposed
def test_refcountdisposable_refcounting(): d = BooleanDisposable() r = RefCountDisposable(d) assert not d.is_disposed d1 = r.disposable d2 = r.disposable assert not d.is_disposed d1.dispose() assert not d.is_disposed d2.dispose() assert not d.is_disposed r.dispose() assert d.is_disposed d3 = r.disposable d3.dispose()