blob: a3ff4413eee60f8cd164db2bb39cc34757490736 [file] [log] [blame]
Benjamin Petersona567a772010-03-21 21:00:50 +00001
Christian Heimesb186d002008-03-18 15:15:01 +00002"""Doctest for method/function calls.
Jeremy Hyltonaed0d8d2000-03-28 23:51:17 +00003
Christian Heimesb186d002008-03-18 15:15:01 +00004We're going the use these types for extra testing
Raymond Hettinger40174c32003-05-31 07:04:16 +00005
Neal Norwitzd79bacc2008-03-18 20:58:39 +00006 >>> from collections import UserList
7 >>> from collections import UserDict
Jeremy Hyltonaed0d8d2000-03-28 23:51:17 +00008
Christian Heimesb186d002008-03-18 15:15:01 +00009We're defining four helper functions
Jeremy Hyltonaed0d8d2000-03-28 23:51:17 +000010
Christian Heimesb186d002008-03-18 15:15:01 +000011 >>> def e(a,b):
Neal Norwitzd79bacc2008-03-18 20:58:39 +000012 ... print(a, b)
Jeremy Hyltonaed0d8d2000-03-28 23:51:17 +000013
Christian Heimesb186d002008-03-18 15:15:01 +000014 >>> def f(*a, **k):
Benjamin Petersonee8712c2008-05-20 21:35:26 +000015 ... print(a, support.sortdict(k))
Jeremy Hyltonaed0d8d2000-03-28 23:51:17 +000016
Christian Heimesb186d002008-03-18 15:15:01 +000017 >>> def g(x, *y, **z):
Benjamin Petersonee8712c2008-05-20 21:35:26 +000018 ... print(x, y, support.sortdict(z))
Christian Heimesb186d002008-03-18 15:15:01 +000019
20 >>> def h(j=1, a=2, h=3):
Neal Norwitzd79bacc2008-03-18 20:58:39 +000021 ... print(j, a, h)
Christian Heimesb186d002008-03-18 15:15:01 +000022
23Argument list examples
24
25 >>> f()
26 () {}
27 >>> f(1)
28 (1,) {}
29 >>> f(1, 2)
30 (1, 2) {}
31 >>> f(1, 2, 3)
32 (1, 2, 3) {}
33 >>> f(1, 2, 3, *(4, 5))
34 (1, 2, 3, 4, 5) {}
35 >>> f(1, 2, 3, *[4, 5])
36 (1, 2, 3, 4, 5) {}
Benjamin Peterson025e9eb2015-05-05 20:16:41 -040037 >>> f(*[1, 2, 3], 4, 5)
38 (1, 2, 3, 4, 5) {}
Christian Heimesb186d002008-03-18 15:15:01 +000039 >>> f(1, 2, 3, *UserList([4, 5]))
40 (1, 2, 3, 4, 5) {}
Benjamin Peterson025e9eb2015-05-05 20:16:41 -040041 >>> f(1, 2, 3, *[4, 5], *[6, 7])
42 (1, 2, 3, 4, 5, 6, 7) {}
43 >>> f(1, *[2, 3], 4, *[5, 6], 7)
44 (1, 2, 3, 4, 5, 6, 7) {}
45 >>> f(*UserList([1, 2]), *UserList([3, 4]), 5, *UserList([6, 7]))
46 (1, 2, 3, 4, 5, 6, 7) {}
Christian Heimesb186d002008-03-18 15:15:01 +000047
48Here we add keyword arguments
49
50 >>> f(1, 2, 3, **{'a':4, 'b':5})
51 (1, 2, 3) {'a': 4, 'b': 5}
Benjamin Peterson025e9eb2015-05-05 20:16:41 -040052 >>> f(1, 2, **{'a': -1, 'b': 5}, **{'a': 4, 'c': 6})
53 Traceback (most recent call last):
54 ...
55 TypeError: f() got multiple values for keyword argument 'a'
56 >>> f(1, 2, **{'a': -1, 'b': 5}, a=4, c=6)
57 Traceback (most recent call last):
58 ...
59 TypeError: f() got multiple values for keyword argument 'a'
Serhiy Storchaka3c317e72016-06-12 09:22:01 +030060 >>> f(1, 2, a=3, **{'a': 4}, **{'a': 5})
61 Traceback (most recent call last):
62 ...
63 TypeError: f() got multiple values for keyword argument 'a'
Christian Heimesb186d002008-03-18 15:15:01 +000064 >>> f(1, 2, 3, *[4, 5], **{'a':6, 'b':7})
65 (1, 2, 3, 4, 5) {'a': 6, 'b': 7}
66 >>> f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b': 9})
67 (1, 2, 3, 6, 7) {'a': 8, 'b': 9, 'x': 4, 'y': 5}
Benjamin Peterson025e9eb2015-05-05 20:16:41 -040068 >>> f(1, 2, 3, *[4, 5], **{'c': 8}, **{'a':6, 'b':7})
69 (1, 2, 3, 4, 5) {'a': 6, 'b': 7, 'c': 8}
70 >>> f(1, 2, 3, *(4, 5), x=6, y=7, **{'a':8, 'b': 9})
71 (1, 2, 3, 4, 5) {'a': 8, 'b': 9, 'x': 6, 'y': 7}
Christian Heimesb186d002008-03-18 15:15:01 +000072
73 >>> f(1, 2, 3, **UserDict(a=4, b=5))
74 (1, 2, 3) {'a': 4, 'b': 5}
75 >>> f(1, 2, 3, *(4, 5), **UserDict(a=6, b=7))
76 (1, 2, 3, 4, 5) {'a': 6, 'b': 7}
77 >>> f(1, 2, 3, x=4, y=5, *(6, 7), **UserDict(a=8, b=9))
78 (1, 2, 3, 6, 7) {'a': 8, 'b': 9, 'x': 4, 'y': 5}
Benjamin Peterson025e9eb2015-05-05 20:16:41 -040079 >>> f(1, 2, 3, *(4, 5), x=6, y=7, **UserDict(a=8, b=9))
80 (1, 2, 3, 4, 5) {'a': 8, 'b': 9, 'x': 6, 'y': 7}
Christian Heimesb186d002008-03-18 15:15:01 +000081
82Examples with invalid arguments (TypeErrors). We're also testing the function
83names in the exception messages.
84
85Verify clearing of SF bug #733667
86
87 >>> e(c=4)
88 Traceback (most recent call last):
89 ...
90 TypeError: e() got an unexpected keyword argument 'c'
91
92 >>> g()
93 Traceback (most recent call last):
94 ...
Benjamin Petersone109c702011-06-24 09:37:26 -050095 TypeError: g() missing 1 required positional argument: 'x'
Christian Heimesb186d002008-03-18 15:15:01 +000096
97 >>> g(*())
98 Traceback (most recent call last):
99 ...
Benjamin Petersone109c702011-06-24 09:37:26 -0500100 TypeError: g() missing 1 required positional argument: 'x'
Christian Heimesb186d002008-03-18 15:15:01 +0000101
102 >>> g(*(), **{})
103 Traceback (most recent call last):
104 ...
Benjamin Petersone109c702011-06-24 09:37:26 -0500105 TypeError: g() missing 1 required positional argument: 'x'
Christian Heimesb186d002008-03-18 15:15:01 +0000106
107 >>> g(1)
108 1 () {}
109 >>> g(1, 2)
110 1 (2,) {}
111 >>> g(1, 2, 3)
112 1 (2, 3) {}
113 >>> g(1, 2, 3, *(4, 5))
114 1 (2, 3, 4, 5) {}
115
116 >>> class Nothing: pass
117 ...
118 >>> g(*Nothing())
119 Traceback (most recent call last):
120 ...
Serhiy Storchakab7281052016-09-12 00:52:40 +0300121 TypeError: g() argument after * must be an iterable, not Nothing
Christian Heimesb186d002008-03-18 15:15:01 +0000122
123 >>> class Nothing:
124 ... def __len__(self): return 5
125 ...
126
127 >>> g(*Nothing())
128 Traceback (most recent call last):
129 ...
Serhiy Storchakab7281052016-09-12 00:52:40 +0300130 TypeError: g() argument after * must be an iterable, not Nothing
Christian Heimesb186d002008-03-18 15:15:01 +0000131
132 >>> class Nothing():
133 ... def __len__(self): return 5
134 ... def __getitem__(self, i):
135 ... if i<3: return i
136 ... else: raise IndexError(i)
137 ...
138
139 >>> g(*Nothing())
140 0 (1, 2) {}
141
142 >>> class Nothing:
143 ... def __init__(self): self.c = 0
144 ... def __iter__(self): return self
Neal Norwitzd79bacc2008-03-18 20:58:39 +0000145 ... def __next__(self):
Christian Heimesb186d002008-03-18 15:15:01 +0000146 ... if self.c == 4:
147 ... raise StopIteration
148 ... c = self.c
149 ... self.c += 1
150 ... return c
151 ...
152
153 >>> g(*Nothing())
154 0 (1, 2, 3) {}
155
Martin Panterb5944222016-01-31 06:30:56 +0000156Check for issue #4806: Does a TypeError in a generator get propagated with the
157right error message? (Also check with other iterables.)
158
159 >>> def broken(): raise TypeError("myerror")
160 ...
161
162 >>> g(*(broken() for i in range(1)))
163 Traceback (most recent call last):
164 ...
165 TypeError: myerror
Serhiy Storchaka25e4f772017-08-03 11:37:15 +0300166 >>> g(*range(1), *(broken() for i in range(1)))
167 Traceback (most recent call last):
168 ...
169 TypeError: myerror
Martin Panterb5944222016-01-31 06:30:56 +0000170
171 >>> class BrokenIterable1:
172 ... def __iter__(self):
173 ... raise TypeError('myerror')
174 ...
175 >>> g(*BrokenIterable1())
176 Traceback (most recent call last):
177 ...
178 TypeError: myerror
Serhiy Storchaka25e4f772017-08-03 11:37:15 +0300179 >>> g(*range(1), *BrokenIterable1())
180 Traceback (most recent call last):
181 ...
182 TypeError: myerror
Martin Panterb5944222016-01-31 06:30:56 +0000183
184 >>> class BrokenIterable2:
185 ... def __iter__(self):
186 ... yield 0
187 ... raise TypeError('myerror')
188 ...
189 >>> g(*BrokenIterable2())
190 Traceback (most recent call last):
191 ...
192 TypeError: myerror
Serhiy Storchaka25e4f772017-08-03 11:37:15 +0300193 >>> g(*range(1), *BrokenIterable2())
194 Traceback (most recent call last):
195 ...
196 TypeError: myerror
Martin Panterb5944222016-01-31 06:30:56 +0000197
198 >>> class BrokenSequence:
199 ... def __getitem__(self, idx):
200 ... raise TypeError('myerror')
201 ...
202 >>> g(*BrokenSequence())
203 Traceback (most recent call last):
204 ...
205 TypeError: myerror
Serhiy Storchaka25e4f772017-08-03 11:37:15 +0300206 >>> g(*range(1), *BrokenSequence())
207 Traceback (most recent call last):
208 ...
209 TypeError: myerror
Martin Panterb5944222016-01-31 06:30:56 +0000210
Christian Heimesb186d002008-03-18 15:15:01 +0000211Make sure that the function doesn't stomp the dictionary
212
213 >>> d = {'a': 1, 'b': 2, 'c': 3}
214 >>> d2 = d.copy()
215 >>> g(1, d=4, **d)
216 1 () {'a': 1, 'b': 2, 'c': 3, 'd': 4}
217 >>> d == d2
218 True
219
220What about willful misconduct?
221
222 >>> def saboteur(**kw):
223 ... kw['x'] = 'm'
224 ... return kw
225
226 >>> d = {}
227 >>> kw = saboteur(a=1, **d)
228 >>> d
229 {}
Jeremy Hyltonaed0d8d2000-03-28 23:51:17 +0000230
Guido van Rossumd59da4b2007-05-22 18:11:13 +0000231
Christian Heimesb186d002008-03-18 15:15:01 +0000232 >>> g(1, 2, 3, **{'x': 4, 'y': 5})
233 Traceback (most recent call last):
234 ...
Benjamin Petersonb204a422011-06-05 22:04:07 -0500235 TypeError: g() got multiple values for argument 'x'
Christian Heimesb186d002008-03-18 15:15:01 +0000236
237 >>> f(**{1:2})
238 Traceback (most recent call last):
239 ...
240 TypeError: f() keywords must be strings
241
242 >>> h(**{'e': 2})
243 Traceback (most recent call last):
244 ...
245 TypeError: h() got an unexpected keyword argument 'e'
246
247 >>> h(*h)
248 Traceback (most recent call last):
249 ...
Serhiy Storchakab7281052016-09-12 00:52:40 +0300250 TypeError: h() argument after * must be an iterable, not function
Christian Heimesb186d002008-03-18 15:15:01 +0000251
Serhiy Storchaka73442852016-10-02 10:33:46 +0300252 >>> h(1, *h)
253 Traceback (most recent call last):
254 ...
255 TypeError: h() argument after * must be an iterable, not function
256
257 >>> h(*[1], *h)
258 Traceback (most recent call last):
259 ...
260 TypeError: h() argument after * must be an iterable, not function
261
Christian Heimesb186d002008-03-18 15:15:01 +0000262 >>> dir(*h)
263 Traceback (most recent call last):
264 ...
Serhiy Storchakab7281052016-09-12 00:52:40 +0300265 TypeError: dir() argument after * must be an iterable, not function
Christian Heimesb186d002008-03-18 15:15:01 +0000266
267 >>> None(*h)
268 Traceback (most recent call last):
269 ...
Serhiy Storchakab7281052016-09-12 00:52:40 +0300270 TypeError: NoneType object argument after * must be an iterable, \
271not function
Christian Heimesb186d002008-03-18 15:15:01 +0000272
273 >>> h(**h)
274 Traceback (most recent call last):
275 ...
Serhiy Storchakab7281052016-09-12 00:52:40 +0300276 TypeError: h() argument after ** must be a mapping, not function
Christian Heimesb186d002008-03-18 15:15:01 +0000277
Serhiy Storchakae036ef82016-10-02 11:06:43 +0300278 >>> h(**[])
279 Traceback (most recent call last):
280 ...
281 TypeError: h() argument after ** must be a mapping, not list
282
283 >>> h(a=1, **h)
284 Traceback (most recent call last):
285 ...
286 TypeError: h() argument after ** must be a mapping, not function
287
288 >>> h(a=1, **[])
289 Traceback (most recent call last):
290 ...
291 TypeError: h() argument after ** must be a mapping, not list
292
293 >>> h(**{'a': 1}, **h)
294 Traceback (most recent call last):
295 ...
296 TypeError: h() argument after ** must be a mapping, not function
297
298 >>> h(**{'a': 1}, **[])
299 Traceback (most recent call last):
300 ...
301 TypeError: h() argument after ** must be a mapping, not list
302
Christian Heimesb186d002008-03-18 15:15:01 +0000303 >>> dir(**h)
304 Traceback (most recent call last):
305 ...
Serhiy Storchakab7281052016-09-12 00:52:40 +0300306 TypeError: dir() argument after ** must be a mapping, not function
Christian Heimesb186d002008-03-18 15:15:01 +0000307
308 >>> None(**h)
309 Traceback (most recent call last):
310 ...
Serhiy Storchakab7281052016-09-12 00:52:40 +0300311 TypeError: NoneType object argument after ** must be a mapping, \
312not function
Christian Heimesb186d002008-03-18 15:15:01 +0000313
314 >>> dir(b=1, **{'b': 1})
315 Traceback (most recent call last):
316 ...
317 TypeError: dir() got multiple values for keyword argument 'b'
318
Serhiy Storchakaf1ec3ce2019-01-12 10:12:24 +0200319Test a kwargs mapping with duplicated keys.
320
321 >>> from collections.abc import Mapping
322 >>> class MultiDict(Mapping):
323 ... def __init__(self, items):
324 ... self._items = items
325 ...
326 ... def __iter__(self):
327 ... return (k for k, v in self._items)
328 ...
329 ... def __getitem__(self, key):
330 ... for k, v in self._items:
331 ... if k == key:
332 ... return v
333 ... raise KeyError(key)
334 ...
335 ... def __len__(self):
336 ... return len(self._items)
337 ...
338 ... def keys(self):
339 ... return [k for k, v in self._items]
340 ...
341 ... def values(self):
342 ... return [v for k, v in self._items]
343 ...
344 ... def items(self):
345 ... return [(k, v) for k, v in self._items]
346 ...
347 >>> g(**MultiDict([('x', 1), ('y', 2)]))
348 1 () {'y': 2}
349
350 >>> g(**MultiDict([('x', 1), ('x', 2)]))
351 Traceback (most recent call last):
352 ...
353 TypeError: g() got multiple values for keyword argument 'x'
354
355 >>> g(a=3, **MultiDict([('x', 1), ('x', 2)]))
356 Traceback (most recent call last):
357 ...
358 TypeError: g() got multiple values for keyword argument 'x'
359
360 >>> g(**MultiDict([('a', 3)]), **MultiDict([('x', 1), ('x', 2)]))
361 Traceback (most recent call last):
362 ...
363 TypeError: g() got multiple values for keyword argument 'x'
364
Christian Heimesb186d002008-03-18 15:15:01 +0000365Another helper function
366
367 >>> def f2(*a, **b):
368 ... return a, b
Guido van Rossumd59da4b2007-05-22 18:11:13 +0000369
370
Christian Heimesb186d002008-03-18 15:15:01 +0000371 >>> d = {}
Neal Norwitzd79bacc2008-03-18 20:58:39 +0000372 >>> for i in range(512):
Christian Heimesb186d002008-03-18 15:15:01 +0000373 ... key = 'k%d' % i
374 ... d[key] = i
375 >>> a, b = f2(1, *(2,3), **d)
376 >>> len(a), len(b), b == d
377 (3, 512, True)
Raymond Hettinger40174c32003-05-31 07:04:16 +0000378
Christian Heimesb186d002008-03-18 15:15:01 +0000379 >>> class Foo:
380 ... def method(self, arg1, arg2):
381 ... return arg1+arg2
Fred Drake004d5e62000-10-23 17:22:08 +0000382
Christian Heimesb186d002008-03-18 15:15:01 +0000383 >>> x = Foo()
384 >>> Foo.method(*(x, 1, 2))
385 3
386 >>> Foo.method(x, *(1, 2))
387 3
388 >>> Foo.method(*(1, 2, 3))
Neal Norwitzd79bacc2008-03-18 20:58:39 +0000389 5
Christian Heimesb186d002008-03-18 15:15:01 +0000390 >>> Foo.method(1, *[2, 3])
Neal Norwitzd79bacc2008-03-18 20:58:39 +0000391 5
Fred Drake004d5e62000-10-23 17:22:08 +0000392
Ezio Melotti13925002011-03-16 11:05:33 +0200393A PyCFunction that takes only positional parameters should allow an
Christian Heimesb186d002008-03-18 15:15:01 +0000394empty keyword dictionary to pass without a complaint, but raise a
395TypeError if te dictionary is not empty
Jeremy Hylton074c3e62000-03-30 23:55:31 +0000396
Christian Heimesb186d002008-03-18 15:15:01 +0000397 >>> try:
398 ... silence = id(1, *{})
399 ... True
400 ... except:
401 ... False
402 True
Fred Drake004d5e62000-10-23 17:22:08 +0000403
Christian Heimesb186d002008-03-18 15:15:01 +0000404 >>> id(1, **{'foo': 1})
405 Traceback (most recent call last):
406 ...
407 TypeError: id() takes no keyword arguments
Jeremy Hylton074c3e62000-03-30 23:55:31 +0000408
Benjamin Peterson0289b152009-06-28 17:22:03 +0000409A corner case of keyword dictionary items being deleted during
410the function call setup. See <http://bugs.python.org/issue2016>.
411
412 >>> class Name(str):
413 ... def __eq__(self, other):
414 ... try:
415 ... del x[self]
416 ... except KeyError:
417 ... pass
418 ... return str.__eq__(self, other)
419 ... def __hash__(self):
420 ... return str.__hash__(self)
421
422 >>> x = {Name("a"):1, Name("b"):2}
423 >>> def f(a, b):
424 ... print(a,b)
425 >>> f(**x)
426 1 2
Benjamin Petersona567a772010-03-21 21:00:50 +0000427
Benjamin Petersone109c702011-06-24 09:37:26 -0500428Too many arguments:
Benjamin Petersona567a772010-03-21 21:00:50 +0000429
Benjamin Petersone109c702011-06-24 09:37:26 -0500430 >>> def f(): pass
Benjamin Petersonb204a422011-06-05 22:04:07 -0500431 >>> f(1)
432 Traceback (most recent call last):
433 ...
Benjamin Petersone109c702011-06-24 09:37:26 -0500434 TypeError: f() takes 0 positional arguments but 1 was given
435 >>> def f(a): pass
436 >>> f(1, 2)
Benjamin Petersonb204a422011-06-05 22:04:07 -0500437 Traceback (most recent call last):
438 ...
Benjamin Petersone109c702011-06-24 09:37:26 -0500439 TypeError: f() takes 1 positional argument but 2 were given
440 >>> def f(a, b=1): pass
441 >>> f(1, 2, 3)
Benjamin Petersonb204a422011-06-05 22:04:07 -0500442 Traceback (most recent call last):
443 ...
Benjamin Petersone109c702011-06-24 09:37:26 -0500444 TypeError: f() takes from 1 to 2 positional arguments but 3 were given
445 >>> def f(*, kw): pass
446 >>> f(1, kw=3)
Benjamin Petersonb204a422011-06-05 22:04:07 -0500447 Traceback (most recent call last):
448 ...
449 TypeError: f() takes 0 positional arguments but 1 positional argument (and 1 keyword-only argument) were given
Benjamin Petersone109c702011-06-24 09:37:26 -0500450 >>> def f(*, kw, b): pass
451 >>> f(1, 2, 3, b=3, kw=3)
452 Traceback (most recent call last):
453 ...
454 TypeError: f() takes 0 positional arguments but 3 positional arguments (and 2 keyword-only arguments) were given
455 >>> def f(a, b=2, *, kw): pass
456 >>> f(2, 3, 4, kw=4)
457 Traceback (most recent call last):
458 ...
459 TypeError: f() takes from 1 to 2 positional arguments but 3 positional arguments (and 1 keyword-only argument) were given
Benjamin Petersonb204a422011-06-05 22:04:07 -0500460
Benjamin Petersone109c702011-06-24 09:37:26 -0500461Too few and missing arguments:
462
463 >>> def f(a): pass
Benjamin Petersonb204a422011-06-05 22:04:07 -0500464 >>> f()
465 Traceback (most recent call last):
Benjamin Petersone109c702011-06-24 09:37:26 -0500466 ...
467 TypeError: f() missing 1 required positional argument: 'a'
468 >>> def f(a, b): pass
469 >>> f()
Benjamin Petersonb204a422011-06-05 22:04:07 -0500470 Traceback (most recent call last):
Benjamin Petersone109c702011-06-24 09:37:26 -0500471 ...
472 TypeError: f() missing 2 required positional arguments: 'a' and 'b'
473 >>> def f(a, b, c): pass
474 >>> f()
Benjamin Petersonb204a422011-06-05 22:04:07 -0500475 Traceback (most recent call last):
Benjamin Petersone109c702011-06-24 09:37:26 -0500476 ...
477 TypeError: f() missing 3 required positional arguments: 'a', 'b', and 'c'
478 >>> def f(a, b, c, d, e): pass
479 >>> f()
480 Traceback (most recent call last):
481 ...
482 TypeError: f() missing 5 required positional arguments: 'a', 'b', 'c', 'd', and 'e'
483 >>> def f(a, b=4, c=5, d=5): pass
484 >>> f(c=12, b=9)
485 Traceback (most recent call last):
486 ...
487 TypeError: f() missing 1 required positional argument: 'a'
488
489Same with keyword only args:
490
491 >>> def f(*, w): pass
492 >>> f()
493 Traceback (most recent call last):
494 ...
495 TypeError: f() missing 1 required keyword-only argument: 'w'
496 >>> def f(*, a, b, c, d, e): pass
497 >>> f()
498 Traceback (most recent call last):
499 ...
500 TypeError: f() missing 5 required keyword-only arguments: 'a', 'b', 'c', 'd', and 'e'
501
Christian Heimesb186d002008-03-18 15:15:01 +0000502"""
Samuele Pedroni8036c832004-02-21 21:03:30 +0000503
Benjamin Petersona567a772010-03-21 21:00:50 +0000504import sys
Benjamin Petersonee8712c2008-05-20 21:35:26 +0000505from test import support
Samuele Pedroni8036c832004-02-21 21:03:30 +0000506
Christian Heimesb186d002008-03-18 15:15:01 +0000507def test_main():
Benjamin Petersona567a772010-03-21 21:00:50 +0000508 support.run_doctest(sys.modules[__name__], True)
Jeremy Hylton074c3e62000-03-30 23:55:31 +0000509
Christian Heimesb186d002008-03-18 15:15:01 +0000510if __name__ == '__main__':
511 test_main()