Commit 4257453b authored by Stefan Behnel's avatar Stefan Behnel

more test fixes for Py3

parent fdcaa814
...@@ -49,7 +49,7 @@ __doc__ = u""" ...@@ -49,7 +49,7 @@ __doc__ = u"""
>>> g(1,2, c=1, e=0, f=2, d=11) >>> 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, c=1, f=2, e=0, x=25)
>>> g(1,2,3) >>> g(1,2,3) #doctest: +ELLIPSIS
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes at most 3 positional arguments (4 given) TypeError: function takes at most 3 positional arguments (4 given)
>>> g(1,2) >>> g(1,2)
...@@ -84,6 +84,14 @@ __doc__ = u""" ...@@ -84,6 +84,14 @@ __doc__ = u"""
TypeError: required keyword argument 'f' is missing 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: class Spam:
def b(self, a, b, c): def b(self, a, b, c):
pass pass
......
...@@ -84,6 +84,10 @@ __doc__ = u""" ...@@ -84,6 +84,10 @@ __doc__ = u"""
TypeError: required keyword argument 'f' is missing 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: cdef class Ext:
def b(self, a, b, c): def b(self, a, b, c):
pass pass
......
...@@ -8,7 +8,7 @@ __doc__ = u""" ...@@ -8,7 +8,7 @@ __doc__ = u"""
>>> spam(1,2) #doctest: +ELLIPSIS >>> spam(1,2) #doctest: +ELLIPSIS
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (2 given) 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): Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (4 given) TypeError: function takes exactly 3 arguments (4 given)
>>> spam(1,2,3, a=1) #doctest: +ELLIPSIS >>> spam(1,2,3, a=1) #doctest: +ELLIPSIS
...@@ -30,7 +30,7 @@ __doc__ = u""" ...@@ -30,7 +30,7 @@ __doc__ = u"""
>>> swallow(1,2,3) >>> swallow(1,2,3)
(1, 2, 3, ()) (1, 2, 3, ())
>>> swallow(1,2,3,4) #doctest: +ELLIPSIS >>> swallow(1,2,3,4)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes at most 3 positional arguments (4 given) TypeError: function takes at most 3 positional arguments (4 given)
>>> swallow(1,2,3, a=1, b=2) >>> swallow(1,2,3, a=1, b=2)
...@@ -55,10 +55,10 @@ __doc__ = u""" ...@@ -55,10 +55,10 @@ __doc__ = u"""
(1,) (1,)
>>> onlyt(1,2) >>> onlyt(1,2)
(1, 2) (1, 2)
>>> onlyt(a=1) #doctest: +ELLIPSIS >>> onlyt(a=1)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function 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): Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function TypeError: 'a' is an invalid keyword argument for this function
...@@ -66,13 +66,13 @@ __doc__ = u""" ...@@ -66,13 +66,13 @@ __doc__ = u"""
(('a', 1),) (('a', 1),)
>>> onlyk(a=1, b=2) >>> onlyk(a=1, b=2)
(('a', 1), ('b', 2)) (('a', 1), ('b', 2))
>>> onlyk(1) #doctest: +ELLIPSIS >>> onlyk(1)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (1 given) TypeError: function takes at most 0 positional arguments (1 given)
>>> onlyk(1, 2) #doctest: +ELLIPSIS >>> onlyk(1, 2)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (2 given) 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): Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (1 given) TypeError: function takes at most 0 positional arguments (1 given)
...@@ -90,7 +90,11 @@ __doc__ = u""" ...@@ -90,7 +90,11 @@ __doc__ = u"""
import sys, re import sys, re
if sys.version_info[0] >= 3: 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): cdef sorteditems(d):
l = list(d.items()) l = list(d.items())
......
...@@ -81,6 +81,10 @@ __doc__ = u""" ...@@ -81,6 +81,10 @@ __doc__ = u"""
TypeError: required keyword argument 'f' is missing 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): def b(a, b, c):
pass pass
......
__doc__ = u""" __doc__ = u"""
>>> def test(a, b): >>> def test(a, b):
... print((a, b, add(a, b))) ... return (a, b, add(a, b))
>>> test(1, 2) >>> test(1, 2)
(1, 2, 3) (1, 2, 3)
>>> [ repr(f) for f in test(17.3, 88.6) ] >>> [ str(f) for f in test(17.3, 88.6) ]
[17.3, 88.6, 105.9] ['17.3', '88.6', '105.9']
>>> test(u"eggs", u"spam") >>> test(u"eggs", u"spam")
(u'eggs', u'spam', u'eggsspam') (u'eggs', u'spam', u'eggsspam')
""" """
......
...@@ -4,6 +4,10 @@ __doc__ = u""" ...@@ -4,6 +4,10 @@ __doc__ = u"""
TypeError: function takes exactly 3 arguments (0 given) 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: cdef class Spam:
def __init__(self, a, b, int c): def __init__(self, a, b, int c):
......
...@@ -4,15 +4,19 @@ __doc__ = u""" ...@@ -4,15 +4,19 @@ __doc__ = u"""
Traceback (most recent call last): Traceback (most recent call last):
TypeError: an integer is required TypeError: an integer is required
>>> fail0(1,2) >>> fail0(1,2) #doctest: +ELLIPSIS
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes exactly 2 arguments (0 given) TypeError: function takes exactly 2 arguments (0 given)
>>> fail1(1,2) >>> fail1(1,2) #doctest: +ELLIPSIS
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes exactly 2 arguments (1 given) 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 import sys
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
__doc__ = __doc__.replace(u" b'", u" '") __doc__ = __doc__.replace(u" b'", u" '")
......
...@@ -4,7 +4,7 @@ __doc__ = u""" ...@@ -4,7 +4,7 @@ __doc__ = u"""
>>> spam(1,2) #doctest: +ELLIPSIS >>> spam(1,2) #doctest: +ELLIPSIS
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (2 given) 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): Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (4 given) TypeError: function takes exactly 3 arguments (4 given)
>>> spam(1,2,3, a=1) #doctest: +ELLIPSIS >>> spam(1,2,3, a=1) #doctest: +ELLIPSIS
...@@ -26,7 +26,7 @@ __doc__ = u""" ...@@ -26,7 +26,7 @@ __doc__ = u"""
>>> swallow(1,2,3) >>> swallow(1,2,3)
(1, 2, 3, ()) (1, 2, 3, ())
>>> swallow(1,2,3,4) #doctest: +ELLIPSIS >>> swallow(1,2,3,4)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes at most 3 positional arguments (4 given) TypeError: function takes at most 3 positional arguments (4 given)
>>> swallow(1,2,3, a=1, b=2) >>> swallow(1,2,3, a=1, b=2)
...@@ -51,10 +51,10 @@ __doc__ = u""" ...@@ -51,10 +51,10 @@ __doc__ = u"""
(1,) (1,)
>>> onlyt(1,2) >>> onlyt(1,2)
(1, 2) (1, 2)
>>> onlyt(a=1) #doctest: +ELLIPSIS >>> onlyt(a=1)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function 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): Traceback (most recent call last):
TypeError: 'a' is an invalid keyword argument for this function TypeError: 'a' is an invalid keyword argument for this function
...@@ -62,13 +62,13 @@ __doc__ = u""" ...@@ -62,13 +62,13 @@ __doc__ = u"""
(('a', 1),) (('a', 1),)
>>> onlyk(a=1, b=2) >>> onlyk(a=1, b=2)
(('a', 1), ('b', 2)) (('a', 1), ('b', 2))
>>> onlyk(1) #doctest: +ELLIPSIS >>> onlyk(1)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (1 given) TypeError: function takes at most 0 positional arguments (1 given)
>>> onlyk(1, 2) #doctest: +ELLIPSIS >>> onlyk(1, 2)
Traceback (most recent call last): Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (2 given) 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): Traceback (most recent call last):
TypeError: function takes at most 0 positional arguments (1 given) TypeError: function takes at most 0 positional arguments (1 given)
...@@ -86,7 +86,11 @@ __doc__ = u""" ...@@ -86,7 +86,11 @@ __doc__ = u"""
import sys, re import sys, re
if sys.version_info[0] >= 3: 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): cdef sorteditems(d):
l = list(d.items()) l = list(d.items())
......
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