Commit f09666a7 authored by Stefan Behnel's avatar Stefan Behnel

Move a memoryview test out of the "run" test directory since memoryview tests...

Move a memoryview test out of the "run" test directory since memoryview tests tend to be slow and have their own test directory.
parent 196d9e35
# mode: run
# tag: autowrap
# cython: always_allow_keywords=True
cdef void memoryview_func_a(double [:] x):
x[0] = 1
cdef void memoryview_func_b(double [::1] x):
x[0] = 2
cdef void memoryview_func_c(int [:] x):
x[0] = 1
cdef void memoryview_func_d(int [:] x):
x[0] = 2
cdef void memoryview_func_e(int [:,::1] x):
x[0,0] = 4
cdef void memoryview_func_f(int [::1,:] x):
x[0,0] = 4
def test_memview_wrapping():
"""
We're mainly concerned that the code compiles without the names clashing
>>> test_memview_wrapping()
1.0
2.0
1
2
"""
cdef a = memoryview_func_a
cdef b = memoryview_func_b
cdef c = memoryview_func_c
cdef d = memoryview_func_d
cdef e = memoryview_func_e
cdef f = memoryview_func_f
cdef double[1] double_arr = [0]
cdef int[1] int_arr = [0]
a(<double[:1]> double_arr)
print(double_arr[0])
b(<double[:1:1]> double_arr)
print(double_arr[0])
c(<int[:1]> int_arr)
print(int_arr[0])
d(<int[:1:1]> int_arr)
print(int_arr[0])
# don't call e and f because it's harder without needing extra dependencies
# it's mostly a compile test for them
# mode: run # mode: run
# tag: autowrap
# cython: always_allow_keywords=True # cython: always_allow_keywords=True
cimport cython cimport cython
...@@ -229,51 +230,3 @@ def test_cdef_class_params(a, b): ...@@ -229,51 +230,3 @@ def test_cdef_class_params(a, b):
TypeError: Argument 'b' has incorrect type (expected cfunc_convert.B, got cfunc_convert.A) TypeError: Argument 'b' has incorrect type (expected cfunc_convert.B, got cfunc_convert.A)
""" """
return (<object>test_cdef_class_params_cfunc)(a, b) return (<object>test_cdef_class_params_cfunc)(a, b)
cdef void memoryview_func_a(double [:] x):
x[0] = 1
cdef void memoryview_func_b(double [::1] x):
x[0] = 2
cdef void memoryview_func_c(int [:] x):
x[0] = 1
cdef void memoryview_func_d(int [:] x):
x[0] = 2
cdef void memoryview_func_e(int [:,::1] x):
x[0,0] = 4
cdef void memoryview_func_f(int [::1,:] x):
x[0,0] = 4
def test_memview_wrapping():
"""
We're mainly concerned that the code compiles without the names clashing
>>> test_memview_wrapping()
1.0
2.0
1
2
"""
cdef a = memoryview_func_a
cdef b = memoryview_func_b
cdef c = memoryview_func_c
cdef d = memoryview_func_d
cdef e = memoryview_func_e
cdef f = memoryview_func_f
cdef double[1] double_arr = [0]
cdef int[1] int_arr = [0]
a(<double[:1]>double_arr)
print(double_arr[0])
b(<double[:1:1]>double_arr)
print(double_arr[0])
c(<int[:1]>int_arr)
print(int_arr[0])
d(<int[:1:1]>int_arr)
print(int_arr[0])
# don't call e and f because it's harder without needing extra dependencies
# it's mostly a compile test for them
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