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
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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