diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2019-01-12 13:21:30 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2019-01-12 13:21:30 +0100 |
commit | eb57ef1e38143d6402cb72fab09ef69eb7da731c (patch) | |
tree | d02f9aa797a72902c14ea397357a24041d48cd1e | |
parent | 3c218bafbe6097d205418deaaa8c732d79209847 (diff) | |
download | cython-eb57ef1e38143d6402cb72fab09ef69eb7da731c.tar.gz |
Repair some tests after switching to language_level=3str.
-rw-r--r-- | tests/run/array_cimport.srctree | 4 | ||||
-rw-r--r-- | tests/run/cimport.srctree | 6 | ||||
-rw-r--r-- | tests/run/cimport_from_sys_path.srctree | 4 | ||||
-rw-r--r-- | tests/run/public_fused_types.srctree | 6 | ||||
-rw-r--r-- | tests/run/relative_cimport.srctree | 19 |
5 files changed, 28 insertions, 11 deletions
diff --git a/tests/run/array_cimport.srctree b/tests/run/array_cimport.srctree index 4fefade5f..5951f2604 100644 --- a/tests/run/array_cimport.srctree +++ b/tests/run/array_cimport.srctree @@ -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]) diff --git a/tests/run/cimport.srctree b/tests/run/cimport.srctree index 23b4a491a..2d142fbb1 100644 --- a/tests/run/cimport.srctree +++ b/tests/run/cimport.srctree @@ -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 diff --git a/tests/run/cimport_from_sys_path.srctree b/tests/run/cimport_from_sys_path.srctree index e6f619d78..e1541d57c 100644 --- a/tests/run/cimport_from_sys_path.srctree +++ b/tests/run/cimport_from_sys_path.srctree @@ -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)) diff --git a/tests/run/public_fused_types.srctree b/tests/run/public_fused_types.srctree index 54c7aa148..2474e0eaa 100644 --- a/tests/run/public_fused_types.srctree +++ b/tests/run/public_fused_types.srctree @@ -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) diff --git a/tests/run/relative_cimport.srctree b/tests/run/relative_cimport.srctree index 0184fe464..2989f9ac5 100644 --- a/tests/run/relative_cimport.srctree +++ b/tests/run/relative_cimport.srctree @@ -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 |