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