author | John Beck <John.Beck@Oracle.COM> |
Thu, 29 Oct 2015 07:57:11 -0700 | |
changeset 5028 | db8ff415ba49 |
parent 3840 | 39959a8e7a76 |
child 6934 | e72eb275185d |
permissions | -rw-r--r-- |
3840
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
1 |
Trying: |
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)) |
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) # doctest: +IGNORE_EXCEPTION_DETAIL |
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 positional 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 f(x: 'the first argument', y: 'default argument'=1, z=2, |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
85 |
*args: 'varargs', **kw: 'kwargs'): |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
86 |
pass |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
87 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
88 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
89 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
90 |
from inspect import getfullargspec |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
91 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
92 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
93 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
94 |
argspec = getfullargspec(f) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
95 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
96 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
97 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
98 |
argspec.args |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
99 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
100 |
['x', 'y', 'z'] |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
101 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
102 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
103 |
argspec.varargs |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
104 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
105 |
'args' |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
106 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
107 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
108 |
argspec.varkw |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
109 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
110 |
'kw' |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
111 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
112 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
113 |
argspec.defaults |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
114 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
115 |
(1, 2) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
116 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
117 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
118 |
argspec.kwonlyargs |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
119 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
120 |
[] |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
121 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
122 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
123 |
argspec.kwonlydefaults |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
124 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
125 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
126 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
127 |
f.__annotations__ == f.__wrapped__.__annotations__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
128 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
129 |
True |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
130 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
131 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
132 |
@decorator |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
133 |
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
|
134 |
kwstr = ', '.join('%r: %r' % (k, kw[k]) for k in sorted(kw)) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
135 |
print("calling %s with args %s, {%s}" % (f.__name__, args, kwstr)) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
136 |
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
|
137 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
138 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
139 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
140 |
trace # doctest: +ELLIPSIS |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
141 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
142 |
<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
|
143 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
144 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
145 |
@trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
146 |
def func(): pass |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
147 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
148 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
149 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
150 |
func() |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
151 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
152 |
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
|
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 |
@blocking("Please wait ...") |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
156 |
def read_data(): |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
157 |
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
|
158 |
return "some data" |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
159 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
160 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
161 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
162 |
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
|
163 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
164 |
Please wait ... |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
165 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
166 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
167 |
time.sleep(1) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
168 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
169 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
170 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
171 |
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
|
172 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
173 |
Please wait ... |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
174 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
175 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
176 |
time.sleep(1) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
177 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
178 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
179 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
180 |
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
|
181 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
182 |
Please wait ... |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
183 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
184 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
185 |
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
|
186 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
187 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
188 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
189 |
print(read_data()) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
190 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
191 |
some data |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
192 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
193 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
194 |
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
|
195 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
196 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
197 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
198 |
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
|
199 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
200 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
201 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
202 |
@async |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
203 |
def write(data): |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
204 |
# 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
|
205 |
with threading.Lock(): |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
206 |
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
|
207 |
datalist.append(data) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
208 |
# 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
|
209 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
210 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
211 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
212 |
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
|
213 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
214 |
<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
|
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 |
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
|
218 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
219 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
220 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
221 |
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
|
222 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
223 |
<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
|
224 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
225 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
226 |
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
|
227 |
Expecting nothing |
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 |
print(datalist) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
231 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
232 |
['data1', 'data2'] |
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 |
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
|
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 |
@contextmanager |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
240 |
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
|
241 |
print(before) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
242 |
yield |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
243 |
print(after) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
244 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
245 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
246 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
247 |
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
|
248 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
249 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
250 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
251 |
type(ba) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
252 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
253 |
<class 'contextlib._GeneratorContextManager'> |
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 |
with ba: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
257 |
print('hello') |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
258 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
259 |
BEFORE |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
260 |
hello |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
261 |
AFTER |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
262 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
263 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
264 |
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
|
265 |
print(args, kw) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
266 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
267 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
268 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
269 |
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
|
270 |
Expecting nothing |
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 |
f1(1,2) |
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 |
(1, 2) {} |
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 |
f1 = FunctionMaker.create( |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
279 |
'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
|
280 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
281 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
282 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
283 |
print(f1.__source__) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
284 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
285 |
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
|
286 |
f(a, b) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
287 |
<BLANKLINE> |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
288 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
289 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
290 |
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
|
291 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
292 |
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
|
293 |
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
|
294 |
<BLANKLINE> |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
295 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
296 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
297 |
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
|
298 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
299 |
@tail_recursive |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
300 |
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
|
301 |
"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
|
302 |
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
|
303 |
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
|
304 |
<BLANKLINE> |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
305 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
306 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
307 |
print(factorial(4)) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
308 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
309 |
24 |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
310 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
311 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
312 |
@trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
313 |
def f(): |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
314 |
1/0 |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
315 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
316 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
317 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
318 |
f() # doctest: +ELLIPSIS |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
319 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
320 |
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
|
321 |
... |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
322 |
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
|
323 |
File "<doctest __main__[22]>", 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
|
324 |
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
|
325 |
File "<doctest __main__[51]>", 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
|
326 |
1/0 |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
327 |
ZeroDivisionError: ... |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
328 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
329 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
330 |
@trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
331 |
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
|
332 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
333 |
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
|
334 |
... |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
335 |
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
|
336 |
def f(_func_): |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
337 |
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
|
338 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
339 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
340 |
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
|
341 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
342 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
343 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
344 |
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
|
345 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
346 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
347 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
348 |
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
|
349 |
Expecting nothing |
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 = 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
|
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 |
traced_f.attr1 |
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' |
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 |
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
|
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 |
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
|
366 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
367 |
'something else' |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
368 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
369 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
370 |
a = Action() |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
371 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
372 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
373 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
374 |
a.view() # ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
375 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
376 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
377 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
378 |
a.insert() # err |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
379 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
380 |
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
|
381 |
... |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
382 |
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
|
383 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
384 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
385 |
decorator(_memoize).__name__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
386 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
387 |
'_memoize' |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
388 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
389 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
390 |
factorial.__doc__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
391 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
392 |
'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
|
393 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
394 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
395 |
ba.__class__.__name__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
396 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
397 |
'ContextManager' |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
398 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
399 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
400 |
hello('michele') |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
401 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
402 |
BEFORE |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
403 |
hello michele |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
404 |
AFTER |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
405 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
406 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
407 |
@trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
408 |
def f(**kw): pass |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
409 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
410 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
411 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
412 |
f() |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
413 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
414 |
calling f with args (), {} |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
415 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
416 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
417 |
@trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
418 |
def f(*, a=1, **kw): pass |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
419 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
420 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
421 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
422 |
inspect.getfullargspec(f) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
423 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
424 |
FullArgSpec(args=[], varargs=None, varkw='kw', defaults=None, kwonlyargs=['a'], kwonlydefaults={'a': 1}, annotations={}) |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
425 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
426 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
427 |
@trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
428 |
def func(a, b, *args, y=2, z=3, **kwargs): |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
429 |
return y, z |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
430 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
431 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
432 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
433 |
func('a', 'b', 'c', 'd', 'e', y='y', z='z', cat='dog') |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
434 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
435 |
calling func with args ('a', 'b', 'c', 'd', 'e'), {'cat': 'dog', 'y': 'y', 'z': 'z'} |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
436 |
('y', 'z') |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
437 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
438 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
439 |
@trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
440 |
def f(arg, defarg=1, *args, kwonly=2): pass |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
441 |
Expecting nothing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
442 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
443 |
Trying: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
444 |
f.__kwdefaults__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
445 |
Expecting: |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
446 |
{'kwonly': 2} |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
447 |
ok |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
448 |
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
|
449 |
__main__.Action.delete |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
450 |
__main__.Action.insert |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
451 |
__main__.Action.view |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
452 |
__main__.Admin |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
453 |
__main__.Async |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
454 |
__main__.Async.__call__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
455 |
__main__.Async.__init__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
456 |
__main__.PermissionError |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
457 |
__main__.PowerUser |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
458 |
__main__.TailRecursive |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
459 |
__main__.TailRecursive.__call__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
460 |
__main__.TailRecursive.__init__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
461 |
__main__.User |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
462 |
__main__._memoize |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
463 |
__main__._trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
464 |
__main__.before_after |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
465 |
__main__.blocking |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
466 |
__main__.decorator_apply |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
467 |
__main__.example |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
468 |
__main__.fact |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
469 |
__main__.factorial |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
470 |
__main__.get_userclass |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
471 |
__main__.identity_dec |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
472 |
__main__.memoize |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
473 |
__main__.memoize_uw |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
474 |
__main__.on_closing |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
475 |
__main__.on_failure |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
476 |
__main__.on_success |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
477 |
__main__.restricted |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
478 |
__main__.tail_recursive |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
479 |
__main__.trace |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
480 |
8 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
|
481 |
68 tests in __main__ |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
482 |
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
|
483 |
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
|
484 |
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
|
485 |
2 tests in __main__.test_kwonly_no_args |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
486 |
2 tests in __main__.test_kwonly_star_notation |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
487 |
2 tests in __main__.test_kwonlyargs |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
488 |
2 tests in __main__.test_kwonlydefaults |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
489 |
83 tests in 39 items. |
39959a8e7a76
20460239 decorator should have some master test results to compare against
John Beck <John.Beck@Oracle.COM>
parents:
diff
changeset
|
490 |
83 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
|
491 |
Test passed. |