Exemple #1
0
def test_readonly_buffer():
    buf = m.BufferReadOnly(0x64)
    view = memoryview(buf)
    assert view[0] == b"d" if env.PY2 else 0x64
    assert view.readonly
    with pytest.raises(TypeError):
        view[0] = b"\0" if env.PY2 else 0
Exemple #2
0
def test_readonly_buffer():
    buf = m.BufferReadOnly(0x64)
    view = memoryview(buf)
    assert view[0] == b'd' if pytest.PY2 else 0x64
    assert view.readonly
Exemple #3
0
def test_readonly_buffer():
    buf = m.BufferReadOnly(0x64)
    view = memoryview(buf)
    assert view[0] == 0x64 if PY3 else b'd'
    assert view.readonly