Commit eb57ef1e authored by Stefan Behnel's avatar Stefan Behnel

Repair some tests after switching to language_level=3str.

parent 3c218baf
......@@ -32,6 +32,6 @@ from tt cimport Foo
cdef array a = array('i', [1,2,3])
cdef Foo x
print a.data.as_ints[0]
print(a.data.as_ints[0])
x = Foo(a)
print x.obj.data.as_ints[0]
print(x.obj.data.as_ints[0])
......@@ -45,12 +45,12 @@ from other cimport (
A,
foo,
)
print A, foo(10)
print(A, foo(10))
cimport other
print other.A, other.foo(10)
print(other.A, other.foo(10))
from pkg cimport sub
cdef sub.my_int a = 100
from pkg.subpkg cimport submod
\ No newline at end of file
from pkg.subpkg cimport submod
......@@ -32,7 +32,7 @@ static int foo(int a)
######## a.pyx ########
from b.other cimport foo
print foo(10)
print(foo(10))
cimport b.other
print b.other.foo(10)
print(b.other.foo(10))
......@@ -196,8 +196,8 @@ import a as a_mod
def ae(result, expected):
"assert equals"
if result != expected:
print 'result :', result
print 'expected:', expected
print('result :', result)
print('expected:', expected)
assert result == expected
......@@ -227,7 +227,7 @@ ae(myobj.cpdef_method[cy.int, cy.float](10, 10.0), (10, 10.0))
d = {'obj': obj, 'myobj': myobj, 'ae': ae}
exec s in d
exec(s, d)
# Test def methods
# ae(obj.def_method(12, 14.9), 26)
......
......@@ -3,6 +3,7 @@
PYTHON setup.py build_ext --inplace
PYTHON -c "from pkg.b import test; assert test() == (1, 2)"
PYTHON -c "from pkg.b_py2 import test; assert test() == (1, 2)"
PYTHON -c "from pkg.sub.c import test; assert test() == (1, 2)"
######## setup.py ########
......@@ -42,7 +43,23 @@ cdef class test_pxd:
from . cimport a
from .a cimport test_pxd
cimport a as implicitly_relative_a
assert a.test_pxd is test_pxd
def test():
cdef test_pxd obj = test_pxd()
obj.x = 1
obj.y = 2
return (obj.x, obj.y)
######## pkg/b_py2.pyx ########
# cython: language_level=2
from . cimport a
from .a cimport test_pxd
cimport a as implicitly_relative_a # <-- Py2 "feature"
assert a.test_pxd is test_pxd
assert implicitly_relative_a.test_pxd is test_pxd
......
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