1# the calls: 2 3def call0ab(f): 4 """ 5 >>> call0ab(b) 6 Traceback (most recent call last): 7 TypeError: b() takes exactly 3 positional arguments (2 given) 8 >>> call0ab(c) 9 1 2 1 10 >>> call0ab(d) 11 1 2 88 12 """ 13 f(a=1,b=2) 14 15def call0abc(f): 16 """ 17 >>> call0abc(b) 18 1 2 3 19 >>> call0abc(c) 20 1 2 3 21 >>> call0abc(d) 22 1 2 3 23 >>> call0abc(e) 24 1 2 3 [] 25 >>> call0abc(f) 26 1 2 3 42 27 >>> call0abc(m) 28 1 2 3 29 """ 30 f(a=1,b=2,c=3) 31 32def call2(f): 33 """ 34 >>> call2(c) 35 1 2 1 36 >>> call2(d) 37 1 2 88 38 >>> call2(e) 39 1 2 88 [] 40 >>> call2(f) 41 Traceback (most recent call last): 42 TypeError: f() needs keyword-only argument c 43 >>> call2(g) 44 Traceback (most recent call last): 45 TypeError: g() needs keyword-only argument c 46 >>> call2(m) 47 Traceback (most recent call last): 48 TypeError: m() needs keyword-only argument c 49 """ 50 f(1,2) 51 52def call3(f): 53 """ 54 >>> call3(b) 55 1 2 3 56 >>> call3(c) 57 1 2 3 58 >>> call3(d) 59 Traceback (most recent call last): 60 TypeError: d() takes exactly 2 positional arguments (3 given) 61 >>> call3(e) 62 1 2 3 [] 63 >>> call3(f) 64 Traceback (most recent call last): 65 TypeError: f() takes exactly 2 positional arguments (3 given) 66 >>> call3(g) 67 Traceback (most recent call last): 68 TypeError: g() takes exactly 2 positional arguments (3 given) 69 >>> call3(h) 70 Traceback (most recent call last): 71 TypeError: h() needs keyword-only argument c 72 >>> call3(k) 73 Traceback (most recent call last): 74 TypeError: k() needs keyword-only argument f 75 >>> call3(m) 76 Traceback (most recent call last): 77 TypeError: m() takes at most 2 positional arguments (3 given) 78 """ 79 f(1,2,3) 80 81def call4(f): 82 """ 83 >>> call4(b) 84 Traceback (most recent call last): 85 TypeError: b() takes exactly 3 positional arguments (4 given) 86 >>> call4(c) 87 Traceback (most recent call last): 88 TypeError: c() takes at most 3 positional arguments (4 given) 89 >>> call4(e) 90 Traceback (most recent call last): 91 TypeError: e() takes at most 3 positional arguments (4 given) 92 """ 93 f(1,2,3,4) 94 95def call2c(f): 96 """ 97 >>> call2c(d) 98 1 2 1 99 >>> call2c(e) 100 1 2 1 [] 101 >>> call2c(f) 102 1 2 1 42 103 >>> call2c(g) 104 Traceback (most recent call last): 105 TypeError: g() needs keyword-only argument f 106 >>> call2c(m) 107 1 2 1 108 """ 109 f(1,2, c=1) 110 111def call2d(f): 112 """ 113 >>> call2d(d) 114 Traceback (most recent call last): 115 TypeError: d() got an unexpected keyword argument 'd' 116 >>> call2d(e) 117 1 2 88 [('d', 1)] 118 >>> call2d(k) 119 Traceback (most recent call last): 120 TypeError: k() needs keyword-only argument f 121 """ 122 f(1,2, d=1) 123 124def call3d(f): 125 """ 126 >>> call3d(h) 127 Traceback (most recent call last): 128 TypeError: h() needs keyword-only argument c 129 """ 130 f(1,2,3, d=1) 131 132def call2cd(f): 133 """ 134 >>> call2cd(f) 135 1 2 1 2 136 >>> call2cd(m) 137 Traceback (most recent call last): 138 TypeError: m() got an unexpected keyword argument 'd' 139 """ 140 f(1,2, c=1, d=2) 141 142def call2ce(f): 143 """ 144 >>> call2ce(f) 145 Traceback (most recent call last): 146 TypeError: f() got an unexpected keyword argument 'e' 147 """ 148 f(1,2, c=1, e=2) 149 150def call2cde(f): 151 """ 152 >>> call2cde(e) 153 1 2 1 [('d', 2), ('e', 3)] 154 """ 155 f(1,2, c=1, d=2, e=3) 156 157def call2cf(f): 158 """ 159 >>> call2cf(g) 160 1 2 1 42 17 2 [] 161 >>> call2cf(h) 162 1 2 1 42 17 2 () [] 163 >>> call2cf(k) 164 1 2 1 42 17 2 () [] 165 """ 166 f(1,2, c=1, f=2) 167 168def call6cf(f): 169 """ 170 >>> call6cf(h) 171 1 2 1 42 17 2 (3, 4, 5, 6) [] 172 """ 173 f(1,2,3,4,5,6, c=1, f=2) 174 175def call6df(f): 176 """ 177 >>> call6df(k) 178 1 2 3 1 17 2 (4, 5, 6) [] 179 """ 180 f(1,2,3,4,5,6, d=1, f=2) 181 182def call2cfe(f): 183 """ 184 >>> call2cfe(h) 185 1 2 1 42 3 2 () [] 186 >>> call2cfe(k) 187 1 2 1 42 3 2 () [] 188 """ 189 f(1,2, c=1, f=2, e=3) 190 191def call2cefd(f): 192 """ 193 >>> call2cefd(g) 194 1 2 1 11 0 2 [] 195 """ 196 f(1,2, c=1, e=0, f=2, d=11) 197 198def call2cfex(f): 199 """ 200 >>> call2cfex(g) 201 1 2 1 42 0 2 [('x', 25)] 202 """ 203 f(1,2, c=1, f=2, e=0, x=25) 204 205def call6argscfexy(f): 206 args = (1,2,3,4,5,6) 207 f(*args, c=1, f=2, e=3, x=25, y=11) 208 209def call6cfexy(f): 210 """ 211 >>> call6cfexy(h) 212 1 2 1 42 3 2 (3, 4, 5, 6) [('x', 25), ('y', 11)] 213 """ 214 f(1,2,3,4,5,6, c=1, f=2, e=3, x=25, y=11) 215 216def call6dfexy(f): 217 """ 218 >>> call6dfexy(k) 219 1 2 3 1 3 2 (4, 5, 6) [('x', 25), ('y', 11)] 220 """ 221 f(1,2,3,4,5,6, d=1, f=2, e=3, x=25, y=11) 222 223# the called functions: 224 225def b(a, b, c): 226 print a,b,c 227 228def c(a, b, c=1): 229 print a,b,c 230 231def d(a, b, *, c = 88): 232 print a,b,c 233 234def e(a, b, c = 88, **kwds): 235 kwlist = list(kwds.items()) 236 kwlist.sort() 237 print a,b,c, kwlist 238 239def f(a, b, *, c, d = 42): 240 print a,b,c,d 241 242def g(a, b, *, c, d = 42, e = 17, f, **kwds): 243 kwlist = list(kwds.items()) 244 kwlist.sort() 245 print a,b,c,d,e,f, kwlist 246 247def h(a, b, *args, c, d = 42, e = 17, f, **kwds): 248 kwlist = list(kwds.items()) 249 kwlist.sort() 250 print a,b,c,d,e,f, args, kwlist 251 252def k(a, b, c=1, *args, d = 42, e = 17, f, **kwds): 253 kwlist = list(kwds.items()) 254 kwlist.sort() 255 print a,b,c,d,e,f, args, kwlist 256 257def m(a, b=1, *, c): 258 print a,b,c 259