Commit c2101ebc authored by Robert Bradshaw's avatar Robert Bradshaw

buffer access and nogil tests

parent 5330ab1e
...@@ -39,14 +39,37 @@ def test_fast_access(a): ...@@ -39,14 +39,37 @@ def test_fast_access(a):
""" """
cdef array.array ca = a cdef array.array ca = a
assert ca._f[1] == 2.0, ca._f[1]
cdef float value
with nogil:
value = ca._f[1]
assert value == 2.0, value
assert ca._c[:5] == b'\x00\x00\x80?\x00', ca._c[:5] assert ca._c[:5] == b'\x00\x00\x80?\x00', ca._c[:5]
with nogil:
ca._f[1] += 2.0 ca._f[1] += 2.0
assert ca._f[1] == 4.0 assert ca._f[1] == 4.0
def test_fast_buffer_access(a):
"""
>>> a = array.array('f', [1.0, 2.0, 3.0])
>>> test_fast_buffer_access(a)
"""
cdef array.array[float] ca = a
cdef float value
with nogil:
value = ca[1]
assert value == 2.0, value
with nogil:
ca[1] += 2.0
assert ca[1] == 4.0
def test_new_zero(a): def test_new_zero(a):
""" """
>>> a = array.array('f', [1.0, 2.0, 3.0]) >>> a = array.array('f', [1.0, 2.0, 3.0])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment