test_descrtut testresult

cpu-mhz 1603.696
cpu-model AMD Opteron(tm) Processor 242
executable py.py
execution-time 404.297808886
exit-status 1
fspath /home/hpk/pypy-dist/lib-python/modified-2.4.1/test/test_descrtut.py
options oldstylecore
outcome ERR
platform linux2
pypy-revision 29280
python-version-info (2, 4, 2, 'final', 0)
startdate Fri Jun 23 21:08:08 2006
testreport-version 1.1
timeout 1444.0
userhost hpk@cen01

stdout

Trying:
    class A:
        def foo(self):
            print "called A.foo()"
Expecting nothing
ok
Trying:
    class B(A):
        pass
Expecting nothing
ok
Trying:
    class C(A):
        def foo(self):
            B.foo(self)
Expecting nothing
ok
Trying:
    C().foo()
Expecting:
    Traceback (most recent call last):
     ...
    TypeError: unbound method foo() must be called with B instance as first argument (got C instance instead)
**********************************************************************
File "/home/hpk/pypy-dist/lib-python/modified-2.4.1/test/test_descrtut.py", line ?, in test.test_descrtut.__test__.tut8
Failed example:
    C().foo()
Expected:
    Traceback (most recent call last):
     ...
    TypeError: unbound method foo() must be called with B instance as first argument (got C instance instead)
Got:
    called A.foo()
Trying:
    class C(A):
        def foo(self):
            A.foo(self)
Expecting nothing
ok
Trying:
    C().foo()
Expecting:
    called A.foo()
ok
Trying:
    print defaultdict               # show our type
Expecting:
    <class 'test.test_descrtut.defaultdict'>
ok
Trying:
    print type(defaultdict)         # its metatype
Expecting:
    <type 'type'>
ok
Trying:
    a = defaultdict(default=0.0)    # create an instance
Expecting nothing
ok
Trying:
    print a                         # show the instance
Expecting:
    {}
ok
Trying:
    print type(a)                   # show its type
Expecting:
    <class 'test.test_descrtut.defaultdict'>
ok
Trying:
    print a.__class__               # show its class
Expecting:
    <class 'test.test_descrtut.defaultdict'>
ok
Trying:
    print type(a) is a.__class__    # its type is its class
Expecting:
    True
ok
Trying:
    a[1] = 3.25                     # modify the instance
Expecting nothing
ok
Trying:
    print a                         # show the new value
Expecting:
    {1: 3.25}
ok
Trying:
    print a[1]                      # show the new item
Expecting:
    3.25
ok
Trying:
    print a[0]                      # a non-existant item
Expecting:
    0.0
ok
Trying:
    a.merge({1:100, 2:200})         # use a dict method
Expecting nothing
ok
Trying:
    print sortdict(a)               # show the result
Expecting:
    {1: 3.25, 2: 200}
ok
Trying:
    def sorted(seq):
        seq.sort()
        return seq
Expecting nothing
ok
Trying:
    print sorted(a.keys())
Expecting:
    [1, 2]
ok
Trying:
    exec "x = 3; print x" in a
Expecting:
    3
ok
Trying:
    print sorted([str(key) for key in a.keys()])
Expecting:
    ['1', '2', '__builtins__', 'x']
ok
Trying:
    print a['x']
Expecting:
    3
ok
Trying:
    a.default = -1
Expecting nothing
ok
Trying:
    print a["noway"]
Expecting:
    -1
ok
Trying:
    a.default = -1000
Expecting nothing
ok
Trying:
    print a["noway"]
Expecting:
    -1000
ok
Trying:
    'default' in dir(a)
Expecting:
    True
ok
Trying:
    a.x1 = 100
Expecting nothing
ok
Trying:
    a.x2 = 200
Expecting nothing
ok
Trying:
    print a.x1
Expecting:
    100
ok
Trying:
    d = dir(a)
Expecting nothing
ok
Trying:
    'default' in d and 'x1' in d and 'x2' in d
Expecting:
    True
ok
Trying:
    print sortdict(a.__dict__)
Expecting:
    {'default': -1000, 'x1': 100, 'x2': 200}
ok
Trying:
    type([])
Expecting:
    <type 'list'>
ok
Trying:
    [].__class__
Expecting:
    <type 'list'>
ok
Trying:
    list
Expecting:
    <type 'list'>
ok
Trying:
    isinstance([], list)
Expecting:
    True
ok
Trying:
    isinstance([], dict)
Expecting:
    False
ok
Trying:
    isinstance([], object)
Expecting:
    True
ok
Trying:
    [].__methods__
Expecting:
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    AttributeError: 'list' object has no attribute '__methods__'
ok
Trying:
    pprint.pprint(dir(list))    # like list.__dict__.keys(), but sorted
Expecting:
    ['__add__',
     '__class__',
     '__contains__',
     '__delattr__',
     '__delitem__',
     '__doc__',
     '__eq__',
     '__ge__',
     '__getattribute__',
     '__getitem__',
     '__gt__',
     '__hash__',
     '__iadd__',
     '__imul__',
     '__init__',
     '__iter__',
     '__le__',
     '__len__',
     '__lt__',
     '__mul__',
     '__ne__',
     '__new__',
     '__radd__',
     '__reduce__',
     '__reduce_ex__',
     '__repr__',
     '__reversed__',
     '__rmul__',
     '__setattr__',
     '__setitem__',
     '__str__',
     'append',
     'count',
     'extend',
     'index',
     'insert',
     'pop',
     'remove',
     'reverse',
     'sort']
ok
Trying:
    a = ['tic', 'tac']
Expecting nothing
ok
Trying:
    list.__len__(a)          # same as len(a)
Expecting:
    2
ok
Trying:
    a.__len__()              # ditto
Expecting:
    2
ok
Trying:
    list.append(a, 'toe')    # same as a.append('toe')
Expecting nothing
ok
Trying:
    a
Expecting:
    ['tic', 'tac', 'toe']
ok
Trying:
    a = defaultdict2(default=0.0)
Expecting nothing
ok
Trying:
    a[1]
Expecting:
    0.0
ok
Trying:
    a.default = -1
Expecting nothing
ok
Trying:
    a[1]
Expecting:
    -1
ok
Trying:
    a.x1 = 1
Expecting:
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    AttributeError: 'defaultdict2' object has no attribute 'x1'
ok
Trying:
    class property(object):

        def __init__(self, get, set=None):
            self.__get = get
            self.__set = set

        def __get__(self, inst, type=None):
            return self.__get(inst)

        def __set__(self, inst, value):
            if self.__set is None:
                raise AttributeError, "this attribute is read-only"
            return self.__set(inst, value)
Expecting nothing
ok
Trying:
    class C(object):

        def __init__(self):
            self.__x = 0

        def getx(self):
            return self.__x

        def setx(self, x):
            if x < 0: x = 0
            self.__x = x

        x = property(getx, setx)
Expecting nothing
ok
Trying:
    a = C()
Expecting nothing
ok
Trying:
    a.x = 10
Expecting nothing
ok
Trying:
    print a.x
Expecting:
    10
ok
Trying:
    a.x = -10
Expecting nothing
ok
Trying:
    print a.x
Expecting:
    0
ok
Trying:
    del property  # unmask the builtin
Expecting nothing
ok
Trying:
    property
Expecting:
    <type 'property'>
ok
Trying:
    class C(object):
        def __init__(self):
            self.__x = 0
        def getx(self):
            return self.__x
        def setx(self, x):
            if x < 0: x = 0
            self.__x = x
        x = property(getx, setx)
Expecting nothing
ok
Trying:
    a = C()
Expecting nothing
ok
Trying:
    a.x = 10
Expecting nothing
ok
Trying:
    print a.x
Expecting:
    10
ok
Trying:
    a.x = -10
Expecting nothing
ok
Trying:
    print a.x
Expecting:
    0
ok
Trying:
    class C:

        def foo(x, y):
            print "staticmethod", x, y
        foo = staticmethod(foo)
Expecting nothing
ok
Trying:
    C.foo(1, 2)
Expecting:
    staticmethod 1 2
ok
Trying:
    c = C()
Expecting nothing
ok
Trying:
    c.foo(1, 2)
Expecting:
    staticmethod 1 2
ok
Trying:
    class C:
        def foo(cls, y):
            print "classmethod", cls, y
        foo = classmethod(foo)
Expecting nothing
ok
Trying:
    C.foo(1)
Expecting:
    classmethod test.test_descrtut.C 1
ok
Trying:
    c = C()
Expecting nothing
ok
Trying:
    c.foo(1)
Expecting:
    classmethod test.test_descrtut.C 1
ok
Trying:
    class D(C):
        pass
Expecting nothing
ok
Trying:
    D.foo(1)
Expecting:
    classmethod test.test_descrtut.D 1
ok
Trying:
    d = D()
Expecting nothing
ok
Trying:
    d.foo(1)
Expecting:
    classmethod test.test_descrtut.D 1
ok
Trying:
    class E(C):
        def foo(cls, y): # override C.foo
            print "E.foo() called"
            C.foo(y)
        foo = classmethod(foo)
Expecting nothing
ok
Trying:
    E.foo(1)
Expecting:
    E.foo() called
    classmethod test.test_descrtut.C 1
ok
Trying:
    e = E()
Expecting nothing
ok
Trying:
    e.foo(1)
Expecting:
    E.foo() called
    classmethod test.test_descrtut.C 1
ok
Trying:
    print D().m() # "DCBA"
Expecting:
    DCBA
ok
Trying:
    class A:    # classic class
        def save(self):
            print "called A.save()"
Expecting nothing
ok
Trying:
    class B(A):
        pass
Expecting nothing
ok
Trying:
    class C(A):
        def save(self):
            print "called C.save()"
Expecting nothing
ok
Trying:
    class D(B, C):
        pass
Expecting nothing
ok
Trying:
    D().save()
Expecting:
    called A.save()
ok
Trying:
    class A(object):  # new class
        def save(self):
            print "called A.save()"
Expecting nothing
ok
Trying:
    class B(A):
        pass
Expecting nothing
ok
Trying:
    class C(A):
        def save(self):
            print "called C.save()"
Expecting nothing
ok
Trying:
    class D(B, C):
        pass
Expecting nothing
ok
Trying:
    D().save()
Expecting:
    called C.save()
ok
20 items had no tests:
    test.test_descrtut
    test.test_descrtut.A
    test.test_descrtut.A.m
    test.test_descrtut.B
    test.test_descrtut.B.m
    test.test_descrtut.C
    test.test_descrtut.C.m
    test.test_descrtut.D
    test.test_descrtut.D.m
    test.test_descrtut.defaultdict
    test.test_descrtut.defaultdict.__getitem__
    test.test_descrtut.defaultdict.__init__
    test.test_descrtut.defaultdict.get
    test.test_descrtut.defaultdict.merge
    test.test_descrtut.defaultdict2
    test.test_descrtut.defaultdict2.__getitem__
    test.test_descrtut.defaultdict2.__init__
    test.test_descrtut.defaultdict2.get
    test.test_descrtut.defaultdict2.merge
    test.test_descrtut.test_main
7 items passed all tests:
  29 tests in test.test_descrtut.__test__.tut1
   5 tests in test.test_descrtut.__test__.tut2
  13 tests in test.test_descrtut.__test__.tut3
  16 tests in test.test_descrtut.__test__.tut4
  15 tests in test.test_descrtut.__test__.tut5
  10 tests in test.test_descrtut.__test__.tut6
   1 tests in test.test_descrtut.__test__.tut7
**********************************************************************
1 items had failures:
   1 of   6 in test.test_descrtut.__test__.tut8
95 tests in 28 items.
94 passed and 1 failed.
***Test Failed*** 1 failures.

stderr

Loading grammar /home/hpk/pypy-dist/pypy/interpreter/pyparser/data/Grammar2.5a
faking <type 'module'>
faking <type 'file'>
fake-wrapping interp file <open file '<stdout>', mode 'w' at 0x558e6068>
fake-wrapping interp file <open file '<stderr>', mode 'w' at 0x558e60b0>
fake-wrapping interp file <open file '<stdin>', mode 'r' at 0x558e6020>
faking <type 'posix.stat_result'>
faking <type 'posix.statvfs_result'>
Traceback (application-level):
  File "/home/hpk/pypy-dist/pypy/tool/pytest/run-script/regrverbose.py", line 16 in <module>
    indirect_test()
  File "/home/hpk/pypy-dist/lib-python/modified-2.4.1/test/test_descrtut.py", line 489 in test_main
    test_support.run_doctest(test_descrtut, verbose)
  File "/home/hpk/pypy-dist/lib-python/2.4.1/test/test_support.py", line 318 in run_doctest
    raise TestFailed("%d of %d doctests failed" % (f, t))
TestFailed: 1 of 95 doctests failed