Debian Codegraph @

tests/run/versioned_pxds.srctree

raw
1 # mode: run
2 # tag: pxd
3
4 """
5 PYTHON setup.py build_ext --inplace
6 PYTHON -c "import runner"
7 """
8
9 ######## setup.py ########
10
11 from Cython.Build.Dependencies import cythonize
12
13 from distutils.core import setup, Extension
14
15 setup(
16 ext_modules=cythonize([
17 Extension("pkg.m1.a", ["pkg/m1/a.pyx"]),
18 Extension("pkg.m2.b", ["pkg/m2/b.pyx"])
19 ]),
20 )
21
22 ######## pkg/__init__.py ########
23
24 ######## pkg/m1/__init__.py ########
25
26
27 ######## pkg/m1/a.pyx ########
28
29 cdef class A:
30 def __init__(self):
31 self.x = 5
32
33 ######## pkg/m1/a.pxd ########
34
35 to be ignored if there is a more specific file
36
37 ######## pkg/m1/a.cython-2.pxd ########
38
39 very outdated, not to be picked up
40
41 ######## pkg/m1/a.cython-20.pxd ########
42
43 outdated, not to be picked up
44
45 ######## pkg/m1/a.cython-29.pxd ########
46
47 # closest version should get found!
48
49 cdef class A:
50 cdef public float x
51
52 ######## pkg/m1/a.cython-300000.pxd ########
53
54 Invalid distant future syntax right here!
55
56 ######## pkg/m1/a.cython-100000.pxd ########
57
58 Invalid future syntax right here!
59
60
61 ######## pkg/m2/__init__.py ########
62
63 ######## pkg/m2/b.pyx ########
64
65 from pkg.m1.a cimport A
66
67 cdef class B(A):
68 pass
69
70 ######## runner.py ########
71
72 from pkg.m1.a import A
73 from pkg.m2.b import B
74
75 a = A()
76 b = B()
77
78 assert a.x == 5
79 assert isinstance(a.x, float), type(a.x)