From: Stefan Behnel Date: Wed, 14 May 2008 21:54:22 +0000 (+0200) Subject: tons of fixes for the test suite: docstrings must be unicode strings to run in Py3... X-Git-Tag: 0.9.8rc1~37^2~78 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1e7a8d0cef63d95ae334ff26f773ceede9370c6c;p=cython.git tons of fixes for the test suite: docstrings must be unicode strings to run in Py3's doctest (obviously...) --HG-- rename : tests/compile/withnogil.pyx => tests/run/withnogil.pyx --- diff --git a/tests/compile/classmethargdefault.pyx b/tests/compile/classmethargdefault.pyx index 72bdb1c5..3d246eff 100644 --- a/tests/compile/classmethargdefault.pyx +++ b/tests/compile/classmethargdefault.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s = Swallow() >>> s.spam(1) 1 42 'grail' True diff --git a/tests/compile/pinard4.pyx b/tests/compile/pinard4.pyx index c9f66f45..dfdd3179 100644 --- a/tests/compile/pinard4.pyx +++ b/tests/compile/pinard4.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> fiches_CP [] """ diff --git a/tests/compile/withnogil.pyx b/tests/compile/withnogil.pyx deleted file mode 100644 index 0ccfabda..00000000 --- a/tests/compile/withnogil.pyx +++ /dev/null @@ -1,13 +0,0 @@ -cdef object f(object x): - cdef int y - #z = 42 - with nogil: - pass#y = 17 - #z = 88 - -cdef object g(): - with nogil: - h() - -cdef int h() except -1: - pass diff --git a/tests/run/__getattribute__.pyx b/tests/run/__getattribute__.pyx index 5ed494a4..ea71bc2c 100644 --- a/tests/run/__getattribute__.pyx +++ b/tests/run/__getattribute__.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" __getattribute__ and __getattr__ special methods for a single class. >>> a = just_getattribute() diff --git a/tests/run/__getattribute_subclasses__.pyx b/tests/run/__getattribute_subclasses__.pyx index 413e5e9d..a64f3a3c 100644 --- a/tests/run/__getattribute_subclasses__.pyx +++ b/tests/run/__getattribute_subclasses__.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" __getattribute__ and __getattr__ special methods and subclasses. getattr does not override members. diff --git a/tests/run/addloop.pyx b/tests/run/addloop.pyx index 25a82ac2..ca31cb16 100644 --- a/tests/run/addloop.pyx +++ b/tests/run/addloop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> x = 1 >>> for i in range(10): ... x = x + i diff --git a/tests/run/addop.pyx b/tests/run/addop.pyx index 739c214d..513042f1 100644 --- a/tests/run/addop.pyx +++ b/tests/run/addop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() (30, 22) """ diff --git a/tests/run/addressof.pyx b/tests/run/addressof.pyx index 809adb61..59e9de2c 100644 --- a/tests/run/addressof.pyx +++ b/tests/run/addressof.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(5) 5 """ diff --git a/tests/run/altet2.pyx b/tests/run/altet2.pyx index 6110e2d7..fd7fb985 100644 --- a/tests/run/altet2.pyx +++ b/tests/run/altet2.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> iter(C()) Traceback (most recent call last): TypeError: iter() returned non-iterator of type 'NoneType' diff --git a/tests/run/append.pyx b/tests/run/append.pyx index ae936ce3..95ac182a 100644 --- a/tests/run/append.pyx +++ b/tests/run/append.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test_append([]) None None diff --git a/tests/run/ass2global.pyx b/tests/run/ass2global.pyx index 7ae23536..f559b10b 100644 --- a/tests/run/ass2global.pyx +++ b/tests/run/ass2global.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> getg() 5 >>> f(42) diff --git a/tests/run/ass2local.pyx b/tests/run/ass2local.pyx index c929027b..ea904378 100644 --- a/tests/run/ass2local.pyx +++ b/tests/run/ass2local.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() 42 """ diff --git a/tests/run/assert.pyx b/tests/run/assert.pyx index aafcfd9c..83130fa8 100644 --- a/tests/run/assert.pyx +++ b/tests/run/assert.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1, 2, 1) >>> f(0, 2, 1) Traceback (most recent call last): diff --git a/tests/run/attr.pyx b/tests/run/attr.pyx index 70bf7e69..dc01568d 100644 --- a/tests/run/attr.pyx +++ b/tests/run/attr.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> class Test: ... def __init__(self, i): ... self.i = i diff --git a/tests/run/baas3.pyx b/tests/run/baas3.pyx index 66098fc2..47737dc9 100644 --- a/tests/run/baas3.pyx +++ b/tests/run/baas3.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> m = MyClass() >>> m is foo(m) True diff --git a/tests/run/backquote.pyx b/tests/run/backquote.pyx index a7a3f28d..0062d9f0 100644 --- a/tests/run/backquote.pyx +++ b/tests/run/backquote.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(20) '20' >>> f('test') diff --git a/tests/run/behnel1.pyx b/tests/run/behnel1.pyx index 10e264b6..35c73898 100644 --- a/tests/run/behnel1.pyx +++ b/tests/run/behnel1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> viking(5) 5 """ diff --git a/tests/run/behnel2.pyx b/tests/run/behnel2.pyx index b7695b62..fff23d3c 100644 --- a/tests/run/behnel2.pyx +++ b/tests/run/behnel2.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> y 1 >>> y and {} diff --git a/tests/run/behnel3.pyx b/tests/run/behnel3.pyx index 6ec8095f..f16a59d9 100644 --- a/tests/run/behnel3.pyx +++ b/tests/run/behnel3.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> y >>> y or {} {} diff --git a/tests/run/bishop1.pyx b/tests/run/bishop1.pyx index 52c3468c..e9671a2d 100644 --- a/tests/run/bishop1.pyx +++ b/tests/run/bishop1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> m = fmatrix() >>> m[1] = True >>> m.getfoo() diff --git a/tests/run/bishop2.pyx b/tests/run/bishop2.pyx index 24d9c06e..7a2a980b 100644 --- a/tests/run/bishop2.pyx +++ b/tests/run/bishop2.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f = foo() >>> 'a' in f True diff --git a/tests/run/boolop.pyx b/tests/run/boolop.pyx index bdc3e83f..59e2a0f0 100644 --- a/tests/run/boolop.pyx +++ b/tests/run/boolop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> foo(True, False, 23, 'test', 1) (0, 1, False, False) """ diff --git a/tests/run/cfuncdef.pyx b/tests/run/cfuncdef.pyx index 3351885a..17c90c62 100644 --- a/tests/run/cfuncdef.pyx +++ b/tests/run/cfuncdef.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test() """ diff --git a/tests/run/cintop.pyx b/tests/run/cintop.pyx index 40013469..e0a277c9 100644 --- a/tests/run/cintop.pyx +++ b/tests/run/cintop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> int2 = 42 >>> int3 = 7 >>> char1 = ord('C') diff --git a/tests/run/classkwonlyargs.pyx b/tests/run/classkwonlyargs.pyx index 31e5b36e..7246ce77 100644 --- a/tests/run/classkwonlyargs.pyx +++ b/tests/run/classkwonlyargs.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> spam = Spam() >>> b,c,d,e,f,g,h,k = spam.b,spam.c,spam.d,spam.e,spam.f,spam.g,spam.h,spam.k diff --git a/tests/run/classpass.pyx b/tests/run/classpass.pyx index 603d1422..9ac48f5a 100644 --- a/tests/run/classpass.pyx +++ b/tests/run/classpass.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s = Spam() >>> print s.__class__.__name__ Spam diff --git a/tests/run/compiledef.pyx b/tests/run/compiledef.pyx index e083538e..74d980e7 100644 --- a/tests/run/compiledef.pyx +++ b/tests/run/compiledef.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> t True >>> f diff --git a/tests/run/concatcstrings.pyx b/tests/run/concatcstrings.pyx index a524e9e7..ededa0f9 100644 --- a/tests/run/concatcstrings.pyx +++ b/tests/run/concatcstrings.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> spam == "C string 1" + "C string 2" True """ diff --git a/tests/run/cstringmul.pyx b/tests/run/cstringmul.pyx index 6f76adad..c4c638b8 100644 --- a/tests/run/cstringmul.pyx +++ b/tests/run/cstringmul.pyx @@ -1,7 +1,7 @@ -__doc__ = """ - >>> print spam +__doc__ = u""" + >>> print(spam) eggseggseggseggs - >>> print grail + >>> print(grail) tomatotomatotomatotomatotomatotomatotomato """ diff --git a/tests/run/cstruct.pyx b/tests/run/cstruct.pyx index 07a243d6..1a0604bb 100644 --- a/tests/run/cstruct.pyx +++ b/tests/run/cstruct.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test_i() >>> test_c() >>> test_p() diff --git a/tests/run/ct_DEF.pyx b/tests/run/ct_DEF.pyx index b7edc4ce..be7588d8 100644 --- a/tests/run/ct_DEF.pyx +++ b/tests/run/ct_DEF.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> c() 120 >>> i0() == -1 diff --git a/tests/run/ct_IF.pyx b/tests/run/ct_IF.pyx index 58db9efb..08791879 100644 --- a/tests/run/ct_IF.pyx +++ b/tests/run/ct_IF.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() 1 >>> g() diff --git a/tests/run/cunion.pyx b/tests/run/cunion.pyx index 352464a3..61056197 100644 --- a/tests/run/cunion.pyx +++ b/tests/run/cunion.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test_i() >>> test_c() >>> test_p() diff --git a/tests/run/cvardef.pyx b/tests/run/cvardef.pyx index 7ae03133..08fbb493 100644 --- a/tests/run/cvardef.pyx +++ b/tests/run/cvardef.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() """ diff --git a/tests/run/dict.pyx b/tests/run/dict.pyx index 3c51fb07..6058a952 100644 --- a/tests/run/dict.pyx +++ b/tests/run/dict.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> empty() {} >>> keyvalue(1, 2) diff --git a/tests/run/dietachmayer1.pyx b/tests/run/dietachmayer1.pyx index 09e5558e..4cbea160 100644 --- a/tests/run/dietachmayer1.pyx +++ b/tests/run/dietachmayer1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test() 1.0 """ diff --git a/tests/run/exarkun.pyx b/tests/run/exarkun.pyx index 2803e4c5..d313b69d 100644 --- a/tests/run/exarkun.pyx +++ b/tests/run/exarkun.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> p = Point(1,2,3) >>> p.gettuple() (1.0, 2.0, 3.0) diff --git a/tests/run/extclasspass.pyx b/tests/run/extclasspass.pyx index 528e23e5..4529fada 100644 --- a/tests/run/extclasspass.pyx +++ b/tests/run/extclasspass.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> e = Eggs() >>> print type(e).__name__ Eggs diff --git a/tests/run/extinherit.pyx b/tests/run/extinherit.pyx index 633d8c3a..9452a5f0 100644 --- a/tests/run/extinherit.pyx +++ b/tests/run/extinherit.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> p = create() >>> rest(p) 0 diff --git a/tests/run/extinstantiate.pyx b/tests/run/extinstantiate.pyx index b6f1e937..d88f80f6 100644 --- a/tests/run/extinstantiate.pyx +++ b/tests/run/extinstantiate.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> print type(f()).__name__ Spam """ diff --git a/tests/run/extkwonlyargs.pyx b/tests/run/extkwonlyargs.pyx index 5c14e55f..40d1b7bb 100644 --- a/tests/run/extkwonlyargs.pyx +++ b/tests/run/extkwonlyargs.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> ext = Ext() >>> b,c,d,e,f,g,h,k = ext.b,ext.c,ext.d,ext.e,ext.f,ext.g,ext.h,ext.k diff --git a/tests/run/extlen.pyx b/tests/run/extlen.pyx index 2577a02d..6ca4987d 100644 --- a/tests/run/extlen.pyx +++ b/tests/run/extlen.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> len(Spam()) 0 """ diff --git a/tests/run/extstarargs.pyx b/tests/run/extstarargs.pyx index 9e51a71e..5fe21720 100644 --- a/tests/run/extstarargs.pyx +++ b/tests/run/extstarargs.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s = Silly(1,2,3, 'test') >>> (spam,grail,swallow,creosote,onlyt,onlyk,tk) = ( ... s.spam,s.grail,s.swallow,s.creosote,s.onlyt,s.onlyk,s.tk) diff --git a/tests/run/exttype.pyx b/tests/run/exttype.pyx index 408a345d..393c5948 100644 --- a/tests/run/exttype.pyx +++ b/tests/run/exttype.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s = Spam(12) >>> s.eat() 12 42 diff --git a/tests/run/getattr3call.pyx b/tests/run/getattr3call.pyx index 64c847bf..6f629f12 100644 --- a/tests/run/getattr3call.pyx +++ b/tests/run/getattr3call.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> class test(object): a = 1 >>> t = test() diff --git a/tests/run/if.pyx b/tests/run/if.pyx index a1d9dac2..f7c120a6 100644 --- a/tests/run/if.pyx +++ b/tests/run/if.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(0,0) 0 >>> f(1,2) diff --git a/tests/run/include.pyx b/tests/run/include.pyx index c350a74b..9f793965 100644 --- a/tests/run/include.pyx +++ b/tests/run/include.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> D 2 """ diff --git a/tests/run/inop.pyx b/tests/run/inop.pyx index ae5a027c..4f51ca5f 100644 --- a/tests/run/inop.pyx +++ b/tests/run/inop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1,[1,2,3]) True >>> f(5,[1,2,3]) diff --git a/tests/run/ishimoto2.pyx b/tests/run/ishimoto2.pyx index 24541f0c..99957853 100644 --- a/tests/run/ishimoto2.pyx +++ b/tests/run/ishimoto2.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> C().xxx(5) 5 >>> C().xxx() diff --git a/tests/run/ishimoto3.pyx b/tests/run/ishimoto3.pyx index 4954547e..c4d3d3fe 100644 --- a/tests/run/ishimoto3.pyx +++ b/tests/run/ishimoto3.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> c1 = C1() >>> c2 = C2(c1) >>> c1 is c2.getc1() diff --git a/tests/run/isnonebool.pyx b/tests/run/isnonebool.pyx index 56f0dc65..531630fd 100644 --- a/tests/run/isnonebool.pyx +++ b/tests/run/isnonebool.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test_and(None, None) True >>> test_and(None, 1) diff --git a/tests/run/jarausch1.pyx b/tests/run/jarausch1.pyx index 855fb51d..0dd91bb4 100644 --- a/tests/run/jarausch1.pyx +++ b/tests/run/jarausch1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> py_x = r'\\\\' >>> assert x == py_x """ diff --git a/tests/run/kostyrka.pyx b/tests/run/kostyrka.pyx index 2b7f9262..89edf4a5 100644 --- a/tests/run/kostyrka.pyx +++ b/tests/run/kostyrka.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> t = TEST() >>> 1 in t True diff --git a/tests/run/kostyrka2.pyx b/tests/run/kostyrka2.pyx index b85659e4..b89758e3 100644 --- a/tests/run/kostyrka2.pyx +++ b/tests/run/kostyrka2.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> x = X() >>> x.slots [''] diff --git a/tests/run/kwargproblems.pyx b/tests/run/kwargproblems.pyx index 1632eb9d..e22651cb 100644 --- a/tests/run/kwargproblems.pyx +++ b/tests/run/kwargproblems.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> d = {1 : 2} >>> test(**d) Traceback (most recent call last): diff --git a/tests/run/kwonlyargs.pyx b/tests/run/kwonlyargs.pyx index eae17e0b..58fec354 100644 --- a/tests/run/kwonlyargs.pyx +++ b/tests/run/kwonlyargs.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> b(1,2,3) >>> b(1,2,3,4) Traceback (most recent call last): diff --git a/tests/run/lepage_1.pyx b/tests/run/lepage_1.pyx index 0dd1980f..9fc84128 100644 --- a/tests/run/lepage_1.pyx +++ b/tests/run/lepage_1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> a = A(1,2,3) >>> a[0] 1.0 diff --git a/tests/run/list.pyx b/tests/run/list.pyx index 40821b42..e5ac6aa9 100644 --- a/tests/run/list.pyx +++ b/tests/run/list.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1, 2, 3, 4, 5) [] >>> g(1, 2, 3, 4, 5) diff --git a/tests/run/literals.pyx b/tests/run/literals.pyx index 0421d7e3..e310860a 100644 --- a/tests/run/literals.pyx +++ b/tests/run/literals.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> foo() """ diff --git a/tests/run/modbody.pyx b/tests/run/modbody.pyx index 8315b1fc..82a152a0 100644 --- a/tests/run/modbody.pyx +++ b/tests/run/modbody.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() >>> g 42 diff --git a/tests/run/modop.pyx b/tests/run/modop.pyx index 539ccacc..60d49353 100644 --- a/tests/run/modop.pyx +++ b/tests/run/modop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> modobj(9,2) 1 >>> modobj('%d', 5) diff --git a/tests/run/multass.pyx b/tests/run/multass.pyx index 735cee07..cbc50a01 100644 --- a/tests/run/multass.pyx +++ b/tests/run/multass.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() (1, 2, 1, 2) >>> g() diff --git a/tests/run/new_style_exceptions.pyx b/tests/run/new_style_exceptions.pyx index 9dbd97cb..3d5c3dba 100644 --- a/tests/run/new_style_exceptions.pyx +++ b/tests/run/new_style_exceptions.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test(Exception('hi')) Raising: Exception('hi',) Caught: Exception('hi',) diff --git a/tests/run/notinop.pyx b/tests/run/notinop.pyx index f4aae7a6..99a24181 100644 --- a/tests/run/notinop.pyx +++ b/tests/run/notinop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1,[1,2,3]) False >>> f(5,[1,2,3]) diff --git a/tests/run/pass.pyx b/tests/run/pass.pyx index 88c7af0f..57faa768 100644 --- a/tests/run/pass.pyx +++ b/tests/run/pass.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() """ diff --git a/tests/run/pinard5.pyx b/tests/run/pinard5.pyx index 8a2e3510..6cef08c8 100644 --- a/tests/run/pinard5.pyx +++ b/tests/run/pinard5.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test() 1 """ diff --git a/tests/run/pinard6.pyx b/tests/run/pinard6.pyx index 7fadadef..b8bc141a 100644 --- a/tests/run/pinard6.pyx +++ b/tests/run/pinard6.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> x (1, 2) """ diff --git a/tests/run/pinard7.pyx b/tests/run/pinard7.pyx index a464f2cd..0c61c6dc 100644 --- a/tests/run/pinard7.pyx +++ b/tests/run/pinard7.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> c = build() >>> c.method() Traceback (most recent call last): diff --git a/tests/run/pinard8.pyx b/tests/run/pinard8.pyx index e7232fca..b3431148 100644 --- a/tests/run/pinard8.pyx +++ b/tests/run/pinard8.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f = Fiche() >>> f[0] = 1 >>> f.geti() diff --git a/tests/run/powop.pyx b/tests/run/powop.pyx index 10fead42..9882e938 100644 --- a/tests/run/powop.pyx +++ b/tests/run/powop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1.0, 2.95)[0] == f(1.0, 2.95)[1] True diff --git a/tests/run/print.pyx b/tests/run/print.pyx index 67b7e1f4..afcb7829 100644 --- a/tests/run/print.pyx +++ b/tests/run/print.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1, 'test') 1 diff --git a/tests/run/pycmp.pyx b/tests/run/pycmp.pyx index 44a5ff9f..ec4334b5 100644 --- a/tests/run/pycmp.pyx +++ b/tests/run/pycmp.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() >>> g() """ diff --git a/tests/run/pyextattrref.pyx b/tests/run/pyextattrref.pyx index 7ef36467..7b9b9e56 100644 --- a/tests/run/pyextattrref.pyx +++ b/tests/run/pyextattrref.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s = Spam(Eggs("ham")) >>> test(s) 'ham' diff --git a/tests/run/pyintop.pyx b/tests/run/pyintop.pyx index 29734260..cb07fcca 100644 --- a/tests/run/pyintop.pyx +++ b/tests/run/pyintop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1,2,3) 3 >>> g(1,2,3) diff --git a/tests/run/pylistsubtype.pyx b/tests/run/pylistsubtype.pyx index b880fe93..350f9d40 100644 --- a/tests/run/pylistsubtype.pyx +++ b/tests/run/pylistsubtype.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> l1 = Sub1([1,2,3]) >>> len(l1) 3 diff --git a/tests/run/pynumop.pyx b/tests/run/pynumop.pyx index c4f7e09e..19da90af 100644 --- a/tests/run/pynumop.pyx +++ b/tests/run/pynumop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() 6 >>> g() diff --git a/tests/run/r_addint.pyx b/tests/run/r_addint.pyx index 95e73e84..c828a355 100644 --- a/tests/run/r_addint.pyx +++ b/tests/run/r_addint.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> def test(a, b): ... print a, b, add(a, b) diff --git a/tests/run/r_argdefault.pyx b/tests/run/r_argdefault.pyx index 0532f8ae..d321d2ab 100644 --- a/tests/run/r_argdefault.pyx +++ b/tests/run/r_argdefault.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> swallow(name = "Brian") This swallow is called Brian >>> swallow(airspeed = 42) diff --git a/tests/run/r_barbieri1.pyx b/tests/run/r_barbieri1.pyx index e505bf1e..2f75ba41 100644 --- a/tests/run/r_barbieri1.pyx +++ b/tests/run/r_barbieri1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> try: ... B() ... except Exception, e: diff --git a/tests/run/r_bishop3.pyx b/tests/run/r_bishop3.pyx index 1b4d62b3..d4aa7b36 100644 --- a/tests/run/r_bishop3.pyx +++ b/tests/run/r_bishop3.pyx @@ -1,9 +1,11 @@ -__doc__ = """ -foo = Foo() -fee = Fee() -faa = Faa() -fee.bof() -faa.bof() +__doc__ = u""" +>>> foo = Foo() +>>> fee = Fee() +>>> faa = Faa() +>>> fee.bof() +Fee bof 0 +>>> faa.bof() +Foo bof 0 """ cdef class Foo: diff --git a/tests/run/r_bowden1.pyx b/tests/run/r_bowden1.pyx index 575edc29..920c00f2 100644 --- a/tests/run/r_bowden1.pyx +++ b/tests/run/r_bowden1.pyx @@ -1,6 +1,8 @@ -__doc__ = """ -print f(100) -print g(3000000000) +__doc__ = u""" +>>> print f(100) +101 +>>> print g(3000000000) +3000000001 """ def f(x): diff --git a/tests/run/r_delgado_1.pyx b/tests/run/r_delgado_1.pyx index bef3a034..4c98c131 100644 --- a/tests/run/r_delgado_1.pyx +++ b/tests/run/r_delgado_1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" try: eggs().eat() except RuntimeError, e: diff --git a/tests/run/r_docstrings.pyx b/tests/run/r_docstrings.pyx index cfb6f1e0..27e83271 100644 --- a/tests/run/r_docstrings.pyx +++ b/tests/run/r_docstrings.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f.__doc__ 'This is a function docstring.' diff --git a/tests/run/r_extcomplex2.pyx b/tests/run/r_extcomplex2.pyx index 01317000..458c3fa8 100644 --- a/tests/run/r_extcomplex2.pyx +++ b/tests/run/r_extcomplex2.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> c = eggs() >>> print "eggs returned:", c eggs returned: (17+42j) diff --git a/tests/run/r_extstarargs.pyx b/tests/run/r_extstarargs.pyx index 34740aee..0c474427 100644 --- a/tests/run/r_extstarargs.pyx +++ b/tests/run/r_extstarargs.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s = Swallow("Brian", 42) Name: Brian Airspeed: 42 diff --git a/tests/run/r_forloop.pyx b/tests/run/r_forloop.pyx index 189900f3..7fb8dbcf 100644 --- a/tests/run/r_forloop.pyx +++ b/tests/run/r_forloop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> go() Spam! Spam! diff --git a/tests/run/r_hordijk1.pyx b/tests/run/r_hordijk1.pyx index 3d583f8e..76164558 100644 --- a/tests/run/r_hordijk1.pyx +++ b/tests/run/r_hordijk1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> try: ... s = Spam() ... except StandardError, e: diff --git a/tests/run/r_huss3.pyx b/tests/run/r_huss3.pyx index cc8ab2fa..5e724342 100644 --- a/tests/run/r_huss3.pyx +++ b/tests/run/r_huss3.pyx @@ -1,8 +1,13 @@ -__doc__ = """ -try: - foo() -except Exception, e: - print "%s: %s" % (e.__class__.__name__, e) +__doc__ = u""" +>>> try: +... foo() +... except Exception, e: +... print "%s: %s" % (e.__class__.__name__, e) +ValueError: +>>> try: +... bar() +... except Exception, e: +... print "%s: %s" % (e.__class__.__name__, e) """ def bar(): diff --git a/tests/run/r_jeff_epler_1.pyx b/tests/run/r_jeff_epler_1.pyx index 39975c91..2c08f621 100644 --- a/tests/run/r_jeff_epler_1.pyx +++ b/tests/run/r_jeff_epler_1.pyx @@ -1,5 +1,6 @@ -__doc__ = """ -print r_jeff_epler_1.blowup([2, 3, 5]) +__doc__ = u""" + >>> blowup([2, 3, 5]) + 1 """ def blowup(p): diff --git a/tests/run/r_jiba1.pyx b/tests/run/r_jiba1.pyx index cce2b7f1..f1bfed64 100644 --- a/tests/run/r_jiba1.pyx +++ b/tests/run/r_jiba1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test() This parrot is resting. Lovely plumage! diff --git a/tests/run/r_lepage_3.pyx b/tests/run/r_lepage_3.pyx index 5f594900..a79318cf 100644 --- a/tests/run/r_lepage_3.pyx +++ b/tests/run/r_lepage_3.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" g = r_lepage_3.Grail() g("spam", 42, ["tomato", "sandwich"]) """ diff --git a/tests/run/r_mang1.pyx b/tests/run/r_mang1.pyx index 64ef5613..8357b136 100644 --- a/tests/run/r_mang1.pyx +++ b/tests/run/r_mang1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> import re >>> t ('2',) diff --git a/tests/run/r_mcintyre1.pyx b/tests/run/r_mcintyre1.pyx index a047ffcf..82d365e8 100644 --- a/tests/run/r_mcintyre1.pyx +++ b/tests/run/r_mcintyre1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> b = Bicycle() >>> b.fall_off() Falling off extremely hard diff --git a/tests/run/r_mitch_chapman_2.pyx b/tests/run/r_mitch_chapman_2.pyx index 003f0b51..82057a1c 100644 --- a/tests/run/r_mitch_chapman_2.pyx +++ b/tests/run/r_mitch_chapman_2.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> boolExpressionsFail() 'Not 2b' """ diff --git a/tests/run/r_primes.pyx b/tests/run/r_primes.pyx index b74a44a9..ce74fdf0 100644 --- a/tests/run/r_primes.pyx +++ b/tests/run/r_primes.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> print primes(20) [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71] """ diff --git a/tests/run/r_print.pyx b/tests/run/r_print.pyx index 0742fbc5..6a904ad2 100644 --- a/tests/run/r_print.pyx +++ b/tests/run/r_print.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> frighten() NOBODY expects the Spanish Inquisition! """ diff --git a/tests/run/r_pyclass.pyx b/tests/run/r_pyclass.pyx index ecad7b2b..8ed93e0e 100644 --- a/tests/run/r_pyclass.pyx +++ b/tests/run/r_pyclass.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> order() 42 tons of spam! """ diff --git a/tests/run/r_pyclassdefault.pyx b/tests/run/r_pyclassdefault.pyx index b8528dcf..234ac86b 100644 --- a/tests/run/r_pyclassdefault.pyx +++ b/tests/run/r_pyclassdefault.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> c = CoconutCarrier() >>> c.swallow(name = "Brian") This swallow is called Brian diff --git a/tests/run/r_pythonapi.pyx b/tests/run/r_pythonapi.pyx index 346e5765..89adc474 100644 --- a/tests/run/r_pythonapi.pyx +++ b/tests/run/r_pythonapi.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> x = spam() >>> print repr(x) 'Ftang\\x00Ftang!' diff --git a/tests/run/r_spamtype.pyx b/tests/run/r_spamtype.pyx index ecb4987e..6a087c8a 100644 --- a/tests/run/r_spamtype.pyx +++ b/tests/run/r_spamtype.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s = Spam() >>> print s.get_tons() 17 diff --git a/tests/run/r_starargcall.pyx b/tests/run/r_starargcall.pyx index 3a0a2636..97fbeb42 100644 --- a/tests/run/r_starargcall.pyx +++ b/tests/run/r_starargcall.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> eggs() Args: 1 2 3 Args: buckle my shoe diff --git a/tests/run/r_starargs.pyx b/tests/run/r_starargs.pyx index 18c4493f..bf068076 100644 --- a/tests/run/r_starargs.pyx +++ b/tests/run/r_starargs.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> swallow("Brian", 42) Name: Brian Airspeed: 42 diff --git a/tests/run/r_starargsonly.pyx b/tests/run/r_starargsonly.pyx index c440d2e7..7b68f45f 100644 --- a/tests/run/r_starargsonly.pyx +++ b/tests/run/r_starargsonly.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> spam() Args: () >>> spam(42) diff --git a/tests/run/r_toofewargs.pyx b/tests/run/r_toofewargs.pyx index 331b399d..20acc89d 100644 --- a/tests/run/r_toofewargs.pyx +++ b/tests/run/r_toofewargs.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s = Spam() Traceback (most recent call last): TypeError: function takes exactly 3 arguments (0 given) diff --git a/tests/run/r_vree_1.pyx b/tests/run/r_vree_1.pyx index 7f6f3a53..085b2c8b 100644 --- a/tests/run/r_vree_1.pyx +++ b/tests/run/r_vree_1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test(0) 0L >>> test(1) diff --git a/tests/run/ref2local.pyx b/tests/run/ref2local.pyx index bfe1b8ef..9b108ba9 100644 --- a/tests/run/ref2local.pyx +++ b/tests/run/ref2local.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() 42 """ diff --git a/tests/run/return.pyx b/tests/run/return.pyx index 81a2ddb9..1016c720 100644 --- a/tests/run/return.pyx +++ b/tests/run/return.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f('test') >>> test_g() >>> test_h(5) diff --git a/tests/run/rodriguez_1.pyx b/tests/run/rodriguez_1.pyx index 01838c31..2c2ccab8 100644 --- a/tests/run/rodriguez_1.pyx +++ b/tests/run/rodriguez_1.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> b = B() >>> b.t {1: ((1, 2, 3),), 2: (1, 2, 3)} diff --git a/tests/run/simpcall.pyx b/tests/run/simpcall.pyx index 0f93f69b..8c66c90c 100644 --- a/tests/run/simpcall.pyx +++ b/tests/run/simpcall.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> z(1,9.2,'test') >>> failtype() Traceback (most recent call last): diff --git a/tests/run/sizeof.pyx b/tests/run/sizeof.pyx index 5e071981..f2832cd7 100644 --- a/tests/run/sizeof.pyx +++ b/tests/run/sizeof.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() """ diff --git a/tests/run/slice2.pyx b/tests/run/slice2.pyx index ffbd5155..0cb147c1 100644 --- a/tests/run/slice2.pyx +++ b/tests/run/slice2.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> l = [1,2,3,4] >>> f(1, l, 2, 3) diff --git a/tests/run/slice3.pyx b/tests/run/slice3.pyx index 36f618c7..f3336507 100644 --- a/tests/run/slice3.pyx +++ b/tests/run/slice3.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> class Test(object): ... def __setitem__(self, key, value): ... print key, value diff --git a/tests/run/specialfloat.pyx b/tests/run/specialfloat.pyx index 5a2524d0..dfbe04bb 100644 --- a/tests/run/specialfloat.pyx +++ b/tests/run/specialfloat.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() 12.5 diff --git a/tests/run/starargs.pyx b/tests/run/starargs.pyx index abf5ffd1..803eaa54 100644 --- a/tests/run/starargs.pyx +++ b/tests/run/starargs.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> spam(1,2,3) (1, 2, 3) >>> spam(1,2) diff --git a/tests/run/strconstinclass.pyx b/tests/run/strconstinclass.pyx index 9088a168..72fc7277 100644 --- a/tests/run/strconstinclass.pyx +++ b/tests/run/strconstinclass.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> c = C() >>> print c.x foo diff --git a/tests/run/strfunction.pyx b/tests/run/strfunction.pyx index 2ed6e980..51af8360 100644 --- a/tests/run/strfunction.pyx +++ b/tests/run/strfunction.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> s('test') 'test' >>> z @@ -16,20 +16,26 @@ __doc__ = """ # 'testing a subtype' """ +import sys +if sys.version_info[0] >= 3: + encoding = {'encoding' : 'ASCII'} +else: + encoding = {} + s = str -z = str('test') +z = str('test', **encoding) def c(string): - return str(string) + return str(string, **encoding) class subs(str): pass def sub(string): - return subs(string) + return subs(string, **encoding) #cdef class subs(str): # pass #def csub(string): -# return csubs(string) +# return csubs(string, **encoding) diff --git a/tests/run/subop.pyx b/tests/run/subop.pyx index d71b29ed..25ef4701 100644 --- a/tests/run/subop.pyx +++ b/tests/run/subop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f() (-1, -1) >>> p() diff --git a/tests/run/tuple.pyx b/tests/run/tuple.pyx index 99eb05bb..48473112 100644 --- a/tests/run/tuple.pyx +++ b/tests/run/tuple.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1,2,3,4,5) () >>> g(1,2,3,4,5) diff --git a/tests/run/tuplereassign.pyx b/tests/run/tuplereassign.pyx index bbd56468..2f64a231 100644 --- a/tests/run/tuplereassign.pyx +++ b/tests/run/tuplereassign.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> test1( (1,2,3) ) 1 >>> test3( (1,2,3) ) diff --git a/tests/run/unicodefunction.pyx b/tests/run/unicodefunction.pyx index fe490dff..28284791 100644 --- a/tests/run/unicodefunction.pyx +++ b/tests/run/unicodefunction.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> u('test') u'test' >>> z @@ -16,6 +16,10 @@ __doc__ = """ # u'testing a C subtype' """ +import sys +if sys.version_info[0] >= 3: + __doc__ = __doc__.replace(u" u'", u" '") + u = unicode z = unicode('test') diff --git a/tests/run/unop.pyx b/tests/run/unop.pyx index 1ea4f60a..21609a78 100644 --- a/tests/run/unop.pyx +++ b/tests/run/unop.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1, 2, 3) (-3, -4, 1) """ diff --git a/tests/run/unpack.pyx b/tests/run/unpack.pyx index 3bd36e1a..fd163926 100644 --- a/tests/run/unpack.pyx +++ b/tests/run/unpack.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> f(1, (2,), (3,4,5), (6,(7,(8,9))), 0) (8, 9, (8, 9), (6, (7, (8, 9))), 0) """ diff --git a/tests/run/unpacklistcomp.pyx b/tests/run/unpacklistcomp.pyx index 00c2f7cb..f785deb6 100644 --- a/tests/run/unpacklistcomp.pyx +++ b/tests/run/unpacklistcomp.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> unpack_normal([1,2]) (1, 2) >>> unpack_normal([1,2,3]) # doctest: +ELLIPSIS diff --git a/tests/run/varargcall.pyx b/tests/run/varargcall.pyx index 02626952..ee70ce57 100644 --- a/tests/run/varargcall.pyx +++ b/tests/run/varargcall.pyx @@ -1,4 +1,4 @@ -__doc__ = """ +__doc__ = u""" >>> swallow() """ diff --git a/tests/run/withnogil.pyx b/tests/run/withnogil.pyx new file mode 100644 index 00000000..02a42b74 --- /dev/null +++ b/tests/run/withnogil.pyx @@ -0,0 +1,22 @@ +__doc__ = u""" + >>> f(1) + (1, 17) + >>> g() + 1 +""" + +def f(x): + cdef int y + z = 42 + with nogil: + y = 17 + z = x + return z,y + +def g(): + with nogil: + h() + return 1 + +cdef int h() except -1: + pass diff --git a/tests/run/wundram1.pyx b/tests/run/wundram1.pyx index c8933dae..933a8486 100644 --- a/tests/run/wundram1.pyx +++ b/tests/run/wundram1.pyx @@ -1,8 +1,12 @@ -__doc__ = """ +__doc__ = u""" >>> x 5L """ +import sys +if sys.version_info[0] >= 3: + __doc__ = __doc__.replace(u"5L'", u"5") + cdef unsigned int ui ui = 5 x = ui