1def test1(): 2 """ 3 >>> test1() 4 2 5 """ 6 cdef int[2][2] x 7 x[0][0] = 1 8 x[0][1] = 2 9 x[1][0] = 3 10 x[1][1] = 4 11 return f(x)[1] 12 13cdef int* f(int x[2][2]): 14 return x[0] 15 16 17def assign_index_in_loop(): 18 """ 19 >>> assign_index_in_loop() 20 2 21 """ 22 cdef int i = 0 23 cdef int[1] a 24 cdef int[1] b 25 for a[0], b[0] in enumerate(range(3)): 26 assert a[0] == b[0] 27 assert a[0] == i 28 i += 1 29 30 assert a[0] == b[0] 31 return b[0] 32 33 34def test2(): 35 """ 36 >>> test2() 37 0 38 """ 39 cdef int[5] a1 40 cdef int a2[2+3] 41 return sizeof(a1) - sizeof(a2) 42 43cdef enum: 44 MY_SIZE_A = 2 45 MY_SIZE_B = 3 46 47def test3(): 48 """ 49 >>> test3() 50 (2, 3) 51 """ 52 cdef int a[MY_SIZE_A] 53 cdef int b[MY_SIZE_B] 54 return sizeof(a)/sizeof(int), sizeof(b)/sizeof(int) 55 56 57from libc cimport limits 58 59def test_cimported_attribute(): 60 """ 61 >>> test_cimported_attribute() 62 True 63 """ 64 cdef char a[limits.CHAR_MAX] 65 return sizeof(a) >= 127 66