diff --git a/tests/run/classkwonlyargs.pyx b/tests/run/classkwonlyargs.pyx index 7246ce775018dc1a327c064b89259cda015054f3..92c2eba2e41fe1a534b0168d24c7d522d9760b7c 100644 --- a/tests/run/classkwonlyargs.pyx +++ b/tests/run/classkwonlyargs.pyx @@ -49,7 +49,7 @@ __doc__ = u""" >>> g(1,2, c=1, e=0, f=2, d=11) >>> g(1,2, c=1, f=2, e=0, x=25) - >>> g(1,2,3) + >>> g(1,2,3) #doctest: +ELLIPSIS Traceback (most recent call last): TypeError: function takes at most 3 positional arguments (4 given) >>> g(1,2) @@ -84,6 +84,14 @@ __doc__ = u""" TypeError: required keyword argument 'f' is missing """ +import sys, re +if sys.version_info[0] >= 3: + __doc__ = re.sub(u"Error: (.*)exactly(.*)", u"Error: \\1at most\\2", __doc__) + +import sys, re +if sys.version_info[0] >= 3: + __doc__ = re.sub(u"(ELLIPSIS[^>]*Error: )[^\n]*\n", u"\\1...\n", __doc__, re.M) + class Spam: def b(self, a, b, c): pass diff --git a/tests/run/extkwonlyargs.pyx b/tests/run/extkwonlyargs.pyx index 40d1b7bb579185023620dda58a5be24f3eab7f5a..ca7efbae232436adf09c1582398165d86665cde5 100644 --- a/tests/run/extkwonlyargs.pyx +++ b/tests/run/extkwonlyargs.pyx @@ -84,6 +84,10 @@ __doc__ = u""" TypeError: required keyword argument 'f' is missing """ +import sys, re +if sys.version_info[0] >= 3: + __doc__ = re.sub(u"Error: (.*)exactly(.*)", u"Error: \\1at most\\2", __doc__) + cdef class Ext: def b(self, a, b, c): pass diff --git a/tests/run/extstarargs.pyx b/tests/run/extstarargs.pyx index ade60abb7f5708d2f9e222760468cb63742cf586..b0fb06ec83c9ba8d868149b2ea559a6eb8548090 100644 --- a/tests/run/extstarargs.pyx +++ b/tests/run/extstarargs.pyx @@ -8,7 +8,7 @@ __doc__ = u""" >>> spam(1,2) #doctest: +ELLIPSIS Traceback (most recent call last): TypeError: function takes exactly 3 arguments (2 given) - >>> spam(1,2,3,4) #doctest: +ELLIPSIS + >>> spam(1,2,3,4) Traceback (most recent call last): TypeError: function takes exactly 3 arguments (4 given) >>> spam(1,2,3, a=1) #doctest: +ELLIPSIS @@ -30,7 +30,7 @@ __doc__ = u""" >>> swallow(1,2,3) (1, 2, 3, ()) - >>> swallow(1,2,3,4) #doctest: +ELLIPSIS + >>> swallow(1,2,3,4) Traceback (most recent call last): TypeError: function takes at most 3 positional arguments (4 given) >>> swallow(1,2,3, a=1, b=2) @@ -55,10 +55,10 @@ __doc__ = u""" (1,) >>> onlyt(1,2) (1, 2) - >>> onlyt(a=1) #doctest: +ELLIPSIS + >>> onlyt(a=1) Traceback (most recent call last): TypeError: 'a' is an invalid keyword argument for this function - >>> onlyt(1, a=2) #doctest: +ELLIPSIS + >>> onlyt(1, a=2) Traceback (most recent call last): TypeError: 'a' is an invalid keyword argument for this function @@ -66,13 +66,13 @@ __doc__ = u""" (('a', 1),) >>> onlyk(a=1, b=2) (('a', 1), ('b', 2)) - >>> onlyk(1) #doctest: +ELLIPSIS + >>> onlyk(1) Traceback (most recent call last): TypeError: function takes at most 0 positional arguments (1 given) - >>> onlyk(1, 2) #doctest: +ELLIPSIS + >>> onlyk(1, 2) Traceback (most recent call last): TypeError: function takes at most 0 positional arguments (2 given) - >>> onlyk(1, a=1, b=2) #doctest: +ELLIPSIS + >>> onlyk(1, a=1, b=2) Traceback (most recent call last): TypeError: function takes at most 0 positional arguments (1 given) @@ -90,7 +90,11 @@ __doc__ = u""" import sys, re if sys.version_info[0] >= 3: - __doc__ = re.sub(u"Error: (.*)", u"Error: ...", __doc__) + __doc__ = re.sub(u"Error: (.*)exactly(.*)", u"Error: \\1at most\\2", __doc__) + +import sys, re +if sys.version_info[0] >= 3: + __doc__ = re.sub(u"(ELLIPSIS[^>]*Error: )[^\n]*\n", u"\\1...\n", __doc__, re.M) cdef sorteditems(d): l = list(d.items()) diff --git a/tests/run/kwonlyargs.pyx b/tests/run/kwonlyargs.pyx index 58fec3547212c25ed94902f9ba1325ae15073173..01bccc581757f580e6868e2f2b116c27f5aa2094 100644 --- a/tests/run/kwonlyargs.pyx +++ b/tests/run/kwonlyargs.pyx @@ -81,6 +81,10 @@ __doc__ = u""" TypeError: required keyword argument 'f' is missing """ +import sys, re +if sys.version_info[0] >= 3: + __doc__ = re.sub(u"Error: (.*)exactly(.*)", u"Error: \\1at most\\2", __doc__) + def b(a, b, c): pass diff --git a/tests/run/r_addint.pyx b/tests/run/r_addint.pyx index b04d9f775bb7a3861ea2c5996f544210839a8cc8..399e6d75aad43ae42c7a2b540f7d08f57b625d0f 100644 --- a/tests/run/r_addint.pyx +++ b/tests/run/r_addint.pyx @@ -1,11 +1,11 @@ __doc__ = u""" >>> def test(a, b): - ... print((a, b, add(a, b))) + ... return (a, b, add(a, b)) >>> test(1, 2) (1, 2, 3) - >>> [ repr(f) for f in test(17.3, 88.6) ] - [17.3, 88.6, 105.9] + >>> [ str(f) for f in test(17.3, 88.6) ] + ['17.3', '88.6', '105.9'] >>> test(u"eggs", u"spam") (u'eggs', u'spam', u'eggsspam') """ diff --git a/tests/run/r_toofewargs.pyx b/tests/run/r_toofewargs.pyx index 20acc89d4e714e361463861d62099f51c1b020d6..735fe86f344674f120bb25db53142cfe0b057534 100644 --- a/tests/run/r_toofewargs.pyx +++ b/tests/run/r_toofewargs.pyx @@ -4,6 +4,10 @@ __doc__ = u""" TypeError: function takes exactly 3 arguments (0 given) """ +import sys, re +if sys.version_info[0] >= 3: + __doc__ = re.sub(u"Error: (.*)exactly(.*)", u"Error: \\1at most\\2", __doc__) + cdef class Spam: def __init__(self, a, b, int c): diff --git a/tests/run/simpcall.pyx b/tests/run/simpcall.pyx index 0ce249ef6e4c1ebf7b4f78d019293ae160230886..5e3f5f9e236f02af17827f07137b9f8a5d3fe31a 100644 --- a/tests/run/simpcall.pyx +++ b/tests/run/simpcall.pyx @@ -4,15 +4,19 @@ __doc__ = u""" Traceback (most recent call last): TypeError: an integer is required - >>> fail0(1,2) + >>> fail0(1,2) #doctest: +ELLIPSIS Traceback (most recent call last): TypeError: function takes exactly 2 arguments (0 given) - >>> fail1(1,2) + >>> fail1(1,2) #doctest: +ELLIPSIS Traceback (most recent call last): TypeError: function takes exactly 2 arguments (1 given) """ +import sys, re +if sys.version_info[0] >= 3: + __doc__ = re.sub(u"Error: .*exactly.*", u"Error: ...", __doc__) + import sys if sys.version_info[0] < 3: __doc__ = __doc__.replace(u" b'", u" '") diff --git a/tests/run/starargs.pyx b/tests/run/starargs.pyx index 2ccc5da3355a70521bebb0f6c4bf786672a7435d..5995848af7d03c2b0464fd916fa75f48fe80af02 100644 --- a/tests/run/starargs.pyx +++ b/tests/run/starargs.pyx @@ -4,7 +4,7 @@ __doc__ = u""" >>> spam(1,2) #doctest: +ELLIPSIS Traceback (most recent call last): TypeError: function takes exactly 3 arguments (2 given) - >>> spam(1,2,3,4) #doctest: +ELLIPSIS + >>> spam(1,2,3,4) Traceback (most recent call last): TypeError: function takes exactly 3 arguments (4 given) >>> spam(1,2,3, a=1) #doctest: +ELLIPSIS @@ -26,7 +26,7 @@ __doc__ = u""" >>> swallow(1,2,3) (1, 2, 3, ()) - >>> swallow(1,2,3,4) #doctest: +ELLIPSIS + >>> swallow(1,2,3,4) Traceback (most recent call last): TypeError: function takes at most 3 positional arguments (4 given) >>> swallow(1,2,3, a=1, b=2) @@ -51,10 +51,10 @@ __doc__ = u""" (1,) >>> onlyt(1,2) (1, 2) - >>> onlyt(a=1) #doctest: +ELLIPSIS + >>> onlyt(a=1) Traceback (most recent call last): TypeError: 'a' is an invalid keyword argument for this function - >>> onlyt(1, a=2) #doctest: +ELLIPSIS + >>> onlyt(1, a=2) Traceback (most recent call last): TypeError: 'a' is an invalid keyword argument for this function @@ -62,13 +62,13 @@ __doc__ = u""" (('a', 1),) >>> onlyk(a=1, b=2) (('a', 1), ('b', 2)) - >>> onlyk(1) #doctest: +ELLIPSIS + >>> onlyk(1) Traceback (most recent call last): TypeError: function takes at most 0 positional arguments (1 given) - >>> onlyk(1, 2) #doctest: +ELLIPSIS + >>> onlyk(1, 2) Traceback (most recent call last): TypeError: function takes at most 0 positional arguments (2 given) - >>> onlyk(1, a=1, b=2) #doctest: +ELLIPSIS + >>> onlyk(1, a=1, b=2) Traceback (most recent call last): TypeError: function takes at most 0 positional arguments (1 given) @@ -86,7 +86,11 @@ __doc__ = u""" import sys, re if sys.version_info[0] >= 3: - __doc__ = re.sub(u"Error: (.*)", u"Error: ...", __doc__) + __doc__ = re.sub(u"Error: (.*)exactly(.*)", u"Error: \\1at most\\2", __doc__) + +import sys, re +if sys.version_info[0] >= 3: + __doc__ = re.sub(u"(ELLIPSIS[^>]*Error: )[^\n]*\n", u"\\1...\n", __doc__, re.M) cdef sorteditems(d): l = list(d.items())