>>> test_del_int()
Traceback (most recent call last):
KeyError: 0
->>> test_del_uint()
+>>> test_del_uint() #doctest: +ELLIPSIS
Traceback (most recent call last):
-KeyError: 0
+KeyError: 0...
>>> test_del_longlong() #doctest: +ELLIPSIS
Traceback (most recent call last):
KeyError: 0...
Traceback (most recent call last):
...
TypeError: 'int' object is unsubscriptable
+
+>>> test_unsigned_long()
+>>> test_unsigned_short()
+>>> test_long_long()
"""
def index_object(object o, int i):
return o[i]
+
+
+# These make sure that our fast indexing works with large and unsigned types.
+
+def test_unsigned_long():
+ cdef int i
+ cdef unsigned long ix
+ cdef D = {}
+ for i from 0 <= i < sizeof(unsigned long) * 8:
+ ix = (<unsigned long>1) << i
+ D[ix] = True
+ for i from 0 <= i < sizeof(unsigned long) * 8:
+ ix = (<unsigned long>1) << i
+ assert D[ix] is True
+ del D[ix]
+ assert len(D) == 0
+
+def test_unsigned_short():
+ cdef int i
+ cdef unsigned short ix
+ cdef D = {}
+ for i from 0 <= i < sizeof(unsigned short) * 8:
+ ix = (<unsigned short>1) << i
+ D[ix] = True
+ for i from 0 <= i < sizeof(unsigned short) * 8:
+ ix = (<unsigned short>1) << i
+ assert D[ix] is True
+ del D[ix]
+ assert len(D) == 0
+
+def test_long_long():
+ cdef int i
+ cdef long long ix
+ cdef D = {}
+ for i from 0 <= i < sizeof(long long) * 8:
+ ix = (<long long>1) << i
+ D[ix] = True
+ for i from 0 <= i < sizeof(long long) * 8:
+ ix = (<long long>1) << i
+ assert D[ix] is True
+ del D[ix]
+ assert len(D) == 0