Commit 3d2eaa78 authored by Xavier Thompson's avatar Xavier Thompson

Adapt unit test for cypclass lock errors

parent 84ea02c8
......@@ -9,35 +9,18 @@ cdef cypclass A checklock:
void setter(self, int a):
self.a = a
cdef void take_write_locked(A obj):
pass
cdef int take_read_locked(const A obj):
return 3
def incorrect_locks():
obj = A()
obj.a = 3
obj.getter()
with rlocked obj:
obj.setter(42)
take_write_locked(obj)
obj.a
take_read_locked(obj)
cdef A global_cyobject
return obj.a
cdef void global_lock_taking():
with wlocked global_cyobject:
global_cyobject.setter(global_cyobject.getter() + 1)
_ERRORS = u"""
20:4: Reference 'obj' is not correctly locked in this expression (write lock required)
21:4: Reference 'obj' is not correctly locked in this expression (read lock required)
23:8: Reference 'obj' is not correctly locked in this expression (write lock required)
24:26: Reference 'obj' is not correctly locked in this expression (write lock required)
25:4: Reference 'obj' is not correctly locked in this expression (read lock required)
26:21: Reference 'obj' is not correctly locked in this expression (read lock required)
32:17: Can only lock local variables or arguments
8:15: Reference 'self' is not correctly locked in this expression (read lock required)
10:8: Reference 'self' is not correctly locked in this expression (write lock required)
14:4: Reference 'obj' is not correctly locked in this expression (write lock required)
18:11: Reference 'obj' is not correctly locked in this expression (read lock required)
"""
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