Commit 1e7a8d0c authored by Stefan Behnel's avatar Stefan Behnel

tons of fixes for the test suite: docstrings must be unicode strings to run in...

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
parent e8d06426
__doc__ = """
__doc__ = u"""
>>> s = Swallow()
>>> s.spam(1)
1 42 'grail' True
......
__doc__ = """
__doc__ = u"""
>>> fiches_CP
[]
"""
......
__doc__ = """
__doc__ = u"""
__getattribute__ and __getattr__ special methods for a single class.
>>> a = just_getattribute()
......
__doc__ = """
__doc__ = u"""
__getattribute__ and __getattr__ special methods and subclasses.
getattr does not override members.
......
__doc__ = """
__doc__ = u"""
>>> x = 1
>>> for i in range(10):
... x = x + i
......
__doc__ = """
__doc__ = u"""
>>> f()
(30, 22)
"""
......
__doc__ = """
__doc__ = u"""
>>> f(5)
5
"""
......
__doc__ = """
__doc__ = u"""
>>> iter(C())
Traceback (most recent call last):
TypeError: iter() returned non-iterator of type 'NoneType'
......
__doc__ = """
__doc__ = u"""
>>> test_append([])
None
None
......
__doc__ = """
__doc__ = u"""
>>> getg()
5
>>> f(42)
......
__doc__ = """
__doc__ = u"""
>>> f()
42
"""
......
__doc__ = """
__doc__ = u"""
>>> f(1, 2, 1)
>>> f(0, 2, 1)
Traceback (most recent call last):
......
__doc__ = """
__doc__ = u"""
>>> class Test:
... def __init__(self, i):
... self.i = i
......
__doc__ = """
__doc__ = u"""
>>> m = MyClass()
>>> m is foo(m)
True
......
__doc__ = """
__doc__ = u"""
>>> f(20)
'20'
>>> f('test')
......
__doc__ = """
__doc__ = u"""
>>> viking(5)
5
"""
......
__doc__ = """
__doc__ = u"""
>>> y
1
>>> y and {}
......
__doc__ = """
__doc__ = u"""
>>> y
>>> y or {}
{}
......
__doc__ = """
__doc__ = u"""
>>> m = fmatrix()
>>> m[1] = True
>>> m.getfoo()
......
__doc__ = """
__doc__ = u"""
>>> f = foo()
>>> 'a' in f
True
......
__doc__ = """
__doc__ = u"""
>>> foo(True, False, 23, 'test', 1)
(0, 1, False, False)
"""
......
__doc__ = """
__doc__ = u"""
>>> test()
"""
......
__doc__ = """
__doc__ = u"""
>>> int2 = 42
>>> int3 = 7
>>> char1 = ord('C')
......
__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
......
__doc__ = """
__doc__ = u"""
>>> s = Spam()
>>> print s.__class__.__name__
Spam
......
__doc__ = """
__doc__ = u"""
>>> t
True
>>> f
......
__doc__ = """
__doc__ = u"""
>>> spam == "C string 1" + "C string 2"
True
"""
......
__doc__ = """
>>> print spam
__doc__ = u"""
>>> print(spam)
eggseggseggseggs
>>> print grail
>>> print(grail)
tomatotomatotomatotomatotomatotomatotomato
"""
......
__doc__ = """
__doc__ = u"""
>>> test_i()
>>> test_c()
>>> test_p()
......
__doc__ = """
__doc__ = u"""
>>> c()
120
>>> i0() == -1
......
__doc__ = """
__doc__ = u"""
>>> f()
1
>>> g()
......
__doc__ = """
__doc__ = u"""
>>> test_i()
>>> test_c()
>>> test_p()
......
__doc__ = """
__doc__ = u"""
>>> f()
"""
......
__doc__ = """
__doc__ = u"""
>>> empty()
{}
>>> keyvalue(1, 2)
......
__doc__ = """
__doc__ = u"""
>>> test()
1.0
"""
......
__doc__ = """
__doc__ = u"""
>>> p = Point(1,2,3)
>>> p.gettuple()
(1.0, 2.0, 3.0)
......
__doc__ = """
__doc__ = u"""
>>> e = Eggs()
>>> print type(e).__name__
Eggs
......
__doc__ = """
__doc__ = u"""
>>> p = create()
>>> rest(p)
0
......
__doc__ = """
__doc__ = u"""
>>> print type(f()).__name__
Spam
"""
......
__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
......
__doc__ = """
__doc__ = u"""
>>> len(Spam())
0
"""
......
__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)
......
__doc__ = """
__doc__ = u"""
>>> s = Spam(12)
>>> s.eat()
12 42
......
__doc__ = """
__doc__ = u"""
>>> class test(object): a = 1
>>> t = test()
......
__doc__ = """
__doc__ = u"""
>>> f(0,0)
0
>>> f(1,2)
......
__doc__ = """
__doc__ = u"""
>>> D
2
"""
......
__doc__ = """
__doc__ = u"""
>>> f(1,[1,2,3])
True
>>> f(5,[1,2,3])
......
__doc__ = """
__doc__ = u"""
>>> C().xxx(5)
5
>>> C().xxx()
......
__doc__ = """
__doc__ = u"""
>>> c1 = C1()
>>> c2 = C2(c1)
>>> c1 is c2.getc1()
......
__doc__ = """
__doc__ = u"""
>>> test_and(None, None)
True
>>> test_and(None, 1)
......
__doc__ = """
__doc__ = u"""
>>> py_x = r'\\\\'
>>> assert x == py_x
"""
......
__doc__ = """
__doc__ = u"""
>>> t = TEST()
>>> 1 in t
True
......
__doc__ = """
__doc__ = u"""
>>> x = X()
>>> x.slots
['']
......
__doc__ = """
__doc__ = u"""
>>> d = {1 : 2}
>>> test(**d)
Traceback (most recent call last):
......
__doc__ = """
__doc__ = u"""
>>> b(1,2,3)
>>> b(1,2,3,4)
Traceback (most recent call last):
......
__doc__ = """
__doc__ = u"""
>>> a = A(1,2,3)
>>> a[0]
1.0
......
__doc__ = """
__doc__ = u"""
>>> f(1, 2, 3, 4, 5)
[]
>>> g(1, 2, 3, 4, 5)
......
__doc__ = """
__doc__ = u"""
>>> foo()
"""
......
__doc__ = """
__doc__ = u"""
>>> f()
>>> g
42
......
__doc__ = """
__doc__ = u"""
>>> modobj(9,2)
1
>>> modobj('%d', 5)
......
__doc__ = """
__doc__ = u"""
>>> f()
(1, 2, 1, 2)
>>> g()
......
__doc__ = """
__doc__ = u"""
>>> test(Exception('hi'))
Raising: Exception('hi',)
Caught: Exception('hi',)
......
__doc__ = """
__doc__ = u"""
>>> f(1,[1,2,3])
False
>>> f(5,[1,2,3])
......
__doc__ = """
__doc__ = u"""
>>> f()
"""
......
__doc__ = """
__doc__ = u"""
>>> test()
1
"""
......
__doc__ = """
__doc__ = u"""
>>> x
(1, 2)
"""
......
__doc__ = """
__doc__ = u"""
>>> c = build()
>>> c.method()
Traceback (most recent call last):
......
__doc__ = """
__doc__ = u"""
>>> f = Fiche()
>>> f[0] = 1
>>> f.geti()
......
__doc__ = """
__doc__ = u"""
>>> f(1.0, 2.95)[0] == f(1.0, 2.95)[1]
True
......
__doc__ = """
__doc__ = u"""
>>> f(1, 'test')
<BLANKLINE>
1
......
__doc__ = """
__doc__ = u"""
>>> f()
>>> g()
"""
......
__doc__ = """
__doc__ = u"""
>>> s = Spam(Eggs("ham"))
>>> test(s)
'ham'
......
__doc__ = """
__doc__ = u"""
>>> f(1,2,3)
3
>>> g(1,2,3)
......
__doc__ = """
__doc__ = u"""
>>> l1 = Sub1([1,2,3])
>>> len(l1)
3
......
__doc__ = """
__doc__ = u"""
>>> f()
6
>>> g()
......
__doc__ = """
__doc__ = u"""
>>> def test(a, b):
... print a, b, add(a, b)
......
__doc__ = """
__doc__ = u"""
>>> swallow(name = "Brian")
This swallow is called Brian
>>> swallow(airspeed = 42)
......
__doc__ = """
__doc__ = u"""
>>> try:
... B()
... except Exception, e:
......
__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:
......
__doc__ = """
print f(100)
print g(3000000000)
__doc__ = u"""
>>> print f(100)
101
>>> print g(3000000000)
3000000001
"""
def f(x):
......
__doc__ = """
__doc__ = u"""
try:
eggs().eat()
except RuntimeError, e:
......
__doc__ = """
__doc__ = u"""
>>> f.__doc__
'This is a function docstring.'
......
__doc__ = """
__doc__ = u"""
>>> c = eggs()
>>> print "eggs returned:", c
eggs returned: (17+42j)
......
__doc__ = """
__doc__ = u"""
>>> s = Swallow("Brian", 42)
Name: Brian
Airspeed: 42
......
__doc__ = """
__doc__ = u"""
>>> go()
Spam!
Spam!
......
__doc__ = """
__doc__ = u"""
>>> try:
... s = Spam()
... except StandardError, e:
......
__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():
......
__doc__ = """
print r_jeff_epler_1.blowup([2, 3, 5])
__doc__ = u"""
>>> blowup([2, 3, 5])
1
"""
def blowup(p):
......
__doc__ = """
__doc__ = u"""
>>> test()
This parrot is resting.
Lovely plumage!
......
__doc__ = """
__doc__ = u"""
g = r_lepage_3.Grail()
g("spam", 42, ["tomato", "sandwich"])
"""
......
__doc__ = """
__doc__ = u"""
>>> import re
>>> t
('2',)
......
__doc__ = """
__doc__ = u"""
>>> b = Bicycle()
>>> b.fall_off()
Falling off extremely hard
......
__doc__ = """
__doc__ = u"""
>>> boolExpressionsFail()
'Not 2b'
"""
......
__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]
"""
......
__doc__ = """
__doc__ = u"""
>>> frighten()
NOBODY expects the Spanish Inquisition!
"""
......
__doc__ = """
__doc__ = u"""
>>> order()
42 tons of spam!
"""
......
__doc__ = """
__doc__ = u"""
>>> c = CoconutCarrier()
>>> c.swallow(name = "Brian")
This swallow is called Brian
......
__doc__ = """
__doc__ = u"""
>>> x = spam()
>>> print repr(x)
'Ftang\\x00Ftang!'
......
__doc__ = """
__doc__ = u"""
>>> s = Spam()
>>> print s.get_tons()
17
......
__doc__ = """
__doc__ = u"""
>>> eggs()
Args: 1 2 3
Args: buckle my shoe
......
__doc__ = """
__doc__ = u"""
>>> swallow("Brian", 42)
Name: Brian
Airspeed: 42
......
__doc__ = """
__doc__ = u"""
>>> spam()
Args: ()
>>> spam(42)
......
__doc__ = """
__doc__ = u"""
>>> s = Spam()
Traceback (most recent call last):
TypeError: function takes exactly 3 arguments (0 given)
......
__doc__ = """
__doc__ = u"""
>>> test(0)
0L
>>> test(1)
......
__doc__ = """
__doc__ = u"""
>>> f()
42
"""
......
__doc__ = """
__doc__ = u"""
>>> f('test')
>>> test_g()
>>> test_h(5)
......
__doc__ = """
__doc__ = u"""
>>> b = B()
>>> b.t
{1: ((1, 2, 3),), 2: (1, 2, 3)}
......
__doc__ = """
__doc__ = u"""
>>> z(1,9.2,'test')
>>> failtype()
Traceback (most recent call last):
......
__doc__ = """
__doc__ = u"""
>>> f()
"""
......
__doc__ = """
__doc__ = u"""
>>> l = [1,2,3,4]
>>> f(1, l, 2, 3)
......
__doc__ = """
__doc__ = u"""
>>> class Test(object):
... def __setitem__(self, key, value):
... print key, value
......
__doc__ = """
__doc__ = u"""
>>> f()
12.5
......
__doc__ = """
__doc__ = u"""
>>> spam(1,2,3)
(1, 2, 3)
>>> spam(1,2)
......
__doc__ = """
__doc__ = u"""
>>> c = C()
>>> print c.x
foo
......
__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)
__doc__ = """
__doc__ = u"""
>>> f()
(-1, -1)
>>> p()
......
__doc__ = """
__doc__ = u"""
>>> f(1,2,3,4,5)
()
>>> g(1,2,3,4,5)
......
__doc__ = """
__doc__ = u"""
>>> test1( (1,2,3) )
1
>>> test3( (1,2,3) )
......
__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')
......
__doc__ = """
__doc__ = u"""
>>> f(1, 2, 3)
(-3, -4, 1)
"""
......
__doc__ = """
__doc__ = u"""
>>> f(1, (2,), (3,4,5), (6,(7,(8,9))), 0)
(8, 9, (8, 9), (6, (7, (8, 9))), 0)
"""
......
__doc__ = """
__doc__ = u"""
>>> unpack_normal([1,2])
(1, 2)
>>> unpack_normal([1,2,3]) # doctest: +ELLIPSIS
......
__doc__ = """
__doc__ = u"""
>>> swallow()
"""
......
cdef object f(object x):
__doc__ = u"""
>>> f(1)
(1, 17)
>>> g()
1
"""
def f(x):
cdef int y
#z = 42
z = 42
with nogil:
pass#y = 17
#z = 88
y = 17
z = x
return z,y
cdef object g():
def g():
with nogil:
h()
return 1
cdef int h() except -1:
pass
__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
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