Ejemplo n.º 1
0
def test_rmemory_manager():
    with memorymanagement.rmemory() as rmemory:
        assert rmemory.count == 0
        foo = rmemory.protect(rinterface.conversion._str_to_charsxp('foo'))
        assert rmemory.count == 1
        del (foo)
    assert rmemory.count == 0
Ejemplo n.º 2
0
def test_rmemory_manager_unprotect():
    with memorymanagement.rmemory() as rmemory:
        assert rmemory.count == 0
        foo = rmemory.protect(rinterface.conversion._str_to_charsxp('foo'))
        with pytest.raises(ValueError):
            rmemory.unprotect(2)
        rmemory.unprotect(1)
        assert rmemory.count == 0
    assert rmemory.count == 0
Ejemplo n.º 3
0
def test_rmemory_manager_unprotect_invalid():
    with memorymanagement.rmemory() as rmemory:
        assert rmemory.count == 0
        with pytest.raises(ValueError):
            rmemory.unprotect(2)
    assert rmemory.count == 0