components/python/decorator/test/results-2.7-32.master
author John Beck <John.Beck@Oracle.COM>
Wed, 18 Feb 2015 13:49:02 -0800
changeset 3840 39959a8e7a76
child 5028 db8ff415ba49
permissions -rw-r--r--
20460239 decorator should have some master test results to compare against
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3840
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     1
[?1034hTrying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     2
    @memoize_uw
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     3
    def f1(x):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     4
        time.sleep(1) # simulate some long computation
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     5
        return x
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     6
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     7
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     8
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     9
    from inspect import getargspec 
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    10
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    11
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    12
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    13
    print getargspec(f1) # I am using Python 2.6+ here
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    14
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    15
    ArgSpec(args=[], varargs='args', keywords='kw', defaults=None)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    16
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    17
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    18
    f1(0, 1)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    19
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    20
    Traceback (most recent call last):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    21
       ...
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    22
    TypeError: f1() takes exactly 1 argument (2 given)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    23
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    24
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    25
    from decorator import decorator
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    26
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    27
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    28
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    29
    @memoize
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    30
    def heavy_computation():
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    31
        time.sleep(2)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    32
        return "done"
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    33
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    34
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    35
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    36
    print heavy_computation() # the first time it will take 2 seconds
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    37
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    38
    done
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    39
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    40
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    41
    print heavy_computation() # the second time it will be instantaneous
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    42
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    43
    done
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    44
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    45
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    46
    print getargspec(heavy_computation) 
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    47
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    48
    ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    49
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    50
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    51
    @trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    52
    def f1(x):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    53
        pass
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    54
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    55
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    56
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    57
    f1(0)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    58
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    59
    calling f1 with args (0,), {}
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    60
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    61
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    62
    print getargspec(f1) 
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    63
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    64
    ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    65
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    66
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    67
    @trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    68
    def f(x, y=1, z=2, *args, **kw):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    69
        pass
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    70
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    71
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    72
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    73
    f(0, 3)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    74
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    75
    calling f with args (0, 3, 2), {}
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    76
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    77
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    78
    print getargspec(f) 
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    79
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    80
    ArgSpec(args=['x', 'y', 'z'], varargs='args', keywords='kw', defaults=(1, 2))
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    81
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    82
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    83
    @trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    84
    def exotic_signature((x, y)=(1,2)): return x+y
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    85
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    86
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    87
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    88
    print getargspec(exotic_signature)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    89
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    90
    ArgSpec(args=[['x', 'y']], varargs=None, keywords=None, defaults=((1, 2),))
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    91
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    92
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    93
    exotic_signature() 
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    94
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    95
    calling exotic_signature with args ((1, 2),), {}
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    96
    3
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    97
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    98
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    99
    @decorator
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   100
    def trace(f, *args, **kw):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   101
        print "calling %s with args %s, %s" % (f.func_name, args, kw)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   102
        return f(*args, **kw)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   103
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   104
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   105
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   106
    trace # doctest: +ELLIPSIS
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   107
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   108
    <function trace at 0x...>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   109
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   110
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   111
    @trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   112
    def func(): pass
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   113
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   114
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   115
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   116
    func()
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   117
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   118
    calling func with args (), {}
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   119
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   120
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   121
    @blocking("Please wait ...")
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   122
    def read_data():
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   123
        time.sleep(3) # simulate a blocking resource
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   124
        return "some data"
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   125
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   126
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   127
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   128
    print read_data() # data is not available yet
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   129
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   130
    Please wait ...
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   131
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   132
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   133
    time.sleep(1)  
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   134
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   135
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   136
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   137
    print read_data() # data is not available yet
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   138
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   139
    Please wait ...
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   140
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   141
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   142
    time.sleep(1)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   143
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   144
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   145
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   146
    print read_data() # data is not available yet
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   147
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   148
    Please wait ...
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   149
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   150
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   151
    time.sleep(1.1) # after 3.1 seconds, data is available
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   152
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   153
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   154
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   155
    print read_data()
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   156
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   157
    some data
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   158
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   159
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   160
    async = decorator(Async(threading.Thread))
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   161
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   162
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   163
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   164
    datalist = [] # for simplicity the written data are stored into a list.
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   165
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   166
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   167
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   168
    @async
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   169
    def write(data):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   170
        # append data to the datalist by locking
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   171
        with threading.Lock():
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   172
            time.sleep(1) # emulate some long running operation
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   173
            datalist.append(data)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   174
        # other operations not requiring a lock here
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   175
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   176
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   177
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   178
    write("data1") # doctest: +ELLIPSIS
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   179
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   180
    <Thread(write-1, started...)>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   181
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   182
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   183
    time.sleep(.1) # wait a bit, so we are sure data2 is written after data1
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   184
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   185
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   186
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   187
    write("data2") # doctest: +ELLIPSIS
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   188
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   189
    <Thread(write-2, started...)>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   190
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   191
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   192
    time.sleep(2) # wait for the writers to complete
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   193
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   194
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   195
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   196
    print datalist
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   197
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   198
    ['data1', 'data2']
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   199
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   200
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   201
    from contextlib import contextmanager
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   202
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   203
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   204
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   205
    @contextmanager
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   206
    def before_after(before, after):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   207
        print(before)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   208
        yield
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   209
        print(after)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   210
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   211
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   212
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   213
    ba = before_after('BEFORE', 'AFTER')
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   214
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   215
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   216
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   217
    type(ba)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   218
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   219
    <class 'contextlib.GeneratorContextManager'>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   220
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   221
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   222
    with ba:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   223
        print 'hello'
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   224
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   225
    BEFORE
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   226
    hello
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   227
    AFTER
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   228
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   229
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   230
    def f(*args, **kw): # a function with a generic signature
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   231
        print args, kw
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   232
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   233
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   234
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   235
    f1 = FunctionMaker.create('f1(a, b)', 'f(a, b)', dict(f=f))
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   236
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   237
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   238
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   239
    f1(1,2)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   240
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   241
    (1, 2) {}
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   242
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   243
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   244
    f1 = FunctionMaker.create(
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   245
        'f1(a, b)', 'f(a, b)', dict(f=f), addsource=True)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   246
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   247
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   248
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   249
    print f1.__source__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   250
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   251
    def f1(a, b):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   252
        f(a, b)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   253
    <BLANKLINE>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   254
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   255
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   256
    print inspect.getsource(example)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   257
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   258
        def wrapper(*args, **kw):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   259
            return func(*args, **kw)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   260
    <BLANKLINE>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   261
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   262
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   263
    print inspect.getsource(factorial.__wrapped__)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   264
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   265
    @tail_recursive
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   266
    def factorial(n, acc=1):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   267
        "The good old factorial"
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   268
        if n == 0: return acc
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   269
        return factorial(n-1, n*acc)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   270
    <BLANKLINE>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   271
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   272
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   273
    print factorial(4) 
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   274
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   275
    24
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   276
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   277
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   278
    @trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   279
    def f():
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   280
        1/0
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   281
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   282
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   283
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   284
    f()
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   285
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   286
    Traceback (most recent call last):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   287
      ...
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   288
         File "<string>", line 2, in f
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   289
         File "<doctest __main__[18]>", line 4, in trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   290
           return f(*args, **kw)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   291
         File "<doctest __main__[47]>", line 3, in f
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   292
           1/0
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   293
    ZeroDivisionError: integer division or modulo by zero
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   294
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   295
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   296
    class C(object): 
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   297
         @trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   298
         def meth(self):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   299
             pass
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   300
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   301
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   302
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   303
    class C(object):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   304
         def meth(self):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   305
             pass
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   306
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   307
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   308
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   309
    trace(C.meth)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   310
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   311
    Traceback (most recent call last):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   312
      ...
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   313
    TypeError: You are decorating a non function: <unbound method C.meth>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   314
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   315
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   316
    trace(C.meth.im_func) # doctest: +ELLIPSIS
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   317
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   318
    <function meth at 0x...>
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   319
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   320
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   321
    @trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   322
    def f(_func_): print f
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   323
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   324
    Traceback (most recent call last):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   325
      ...
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   326
    NameError: _func_ is overridden in
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   327
    def f(_func_):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   328
        return _call_(_func_, _func_)
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   329
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   330
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   331
    def f(): pass # the original function
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   332
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   333
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   334
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   335
    f.attr1 = "something" # setting an attribute
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   336
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   337
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   338
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   339
    f.attr2 = "something else" # setting another attribute
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   340
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   341
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   342
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   343
    traced_f = trace(f) # the decorated function
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   344
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   345
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   346
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   347
    traced_f.attr1
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   348
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   349
    'something'
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   350
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   351
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   352
    traced_f.attr2 = "something different" # setting attr
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   353
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   354
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   355
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   356
    f.attr2 # the original attribute did not change
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   357
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   358
    'something else'
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   359
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   360
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   361
    a = Action()
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   362
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   363
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   364
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   365
    a.view() # ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   366
Expecting nothing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   367
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   368
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   369
    a.insert() # err
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   370
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   371
    Traceback (most recent call last):
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   372
       ...
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   373
    PermissionError: User does not have the permission to run insert!
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   374
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   375
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   376
    decorator(_memoize).__name__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   377
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   378
    '_memoize'
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   379
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   380
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   381
    factorial.__doc__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   382
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   383
    'The good old factorial'
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   384
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   385
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   386
    ba.__class__.__name__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   387
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   388
    'ContextManager'
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   389
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   390
Trying:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   391
    hello('michele')
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   392
Expecting:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   393
    BEFORE
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   394
    hello michele
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   395
    AFTER
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   396
ok
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   397
31 items had no tests:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   398
    __main__.Action.delete
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   399
    __main__.Action.insert
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   400
    __main__.Action.view
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   401
    __main__.Admin
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   402
    __main__.Async
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   403
    __main__.Async.__call__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   404
    __main__.Async.__init__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   405
    __main__.PermissionError
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   406
    __main__.PowerUser
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   407
    __main__.TailRecursive
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   408
    __main__.TailRecursive.__call__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   409
    __main__.TailRecursive.__init__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   410
    __main__.User
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   411
    __main__._memoize
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   412
    __main__._trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   413
    __main__.before_after
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   414
    __main__.blocking
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   415
    __main__.decorator_apply
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   416
    __main__.example
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   417
    __main__.fact
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   418
    __main__.factorial
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   419
    __main__.get_userclass
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   420
    __main__.identity_dec
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   421
    __main__.memoize
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   422
    __main__.memoize_uw
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   423
    __main__.on_closing
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   424
    __main__.on_failure
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   425
    __main__.on_success
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   426
    __main__.restricted
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   427
    __main__.tail_recursive
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   428
    __main__.trace
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   429
4 items passed all tests:
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   430
  65 tests in __main__
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   431
   3 tests in __main__.Action
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   432
   2 tests in __main__.a_test_for_pylons
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   433
   2 tests in __main__.hello
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   434
72 tests in 35 items.
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   435
72 passed and 0 failed.
39959a8e7a76 20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
   436
Test passed.