blob: b5a2fd803a808fa9c7e4a3f0f0e3679321d9fdd6 [file] [log] [blame]
Guido van Rossum0b191782002-08-02 18:29:53 +00001"""Unittests for heapq."""
2
Raymond Hettinger2e3dfaf2004-06-13 05:26:33 +00003import sys
Ezio Melotti8269a442011-05-09 07:15:04 +03004import random
Ezio Melotti22ebb2d2013-01-02 21:19:37 +02005import unittest
Guido van Rossum0b191782002-08-02 18:29:53 +00006
Ezio Melotti8269a442011-05-09 07:15:04 +03007from test import support
8from unittest import TestCase, skipUnless
9
Nick Coghlan47384702009-04-22 16:13:36 +000010py_heapq = support.import_fresh_module('heapq', blocked=['_heapq'])
Ezio Melotti8269a442011-05-09 07:15:04 +030011c_heapq = support.import_fresh_module('heapq', fresh=['_heapq'])
Tim Petersaa7d2432002-08-03 02:11:26 +000012
Ezio Melotti8269a442011-05-09 07:15:04 +030013# _heapq.nlargest/nsmallest are saved in heapq._nlargest/_smallest when
14# _heapq is imported, so check them there
15func_names = ['heapify', 'heappop', 'heappush', 'heappushpop',
16 'heapreplace', '_nlargest', '_nsmallest']
17
18class TestModules(TestCase):
19 def test_py_functions(self):
20 for fname in func_names:
21 self.assertEqual(getattr(py_heapq, fname).__module__, 'heapq')
22
23 @skipUnless(c_heapq, 'requires _heapq')
24 def test_c_functions(self):
25 for fname in func_names:
26 self.assertEqual(getattr(c_heapq, fname).__module__, '_heapq')
27
28
Ezio Melotti22ebb2d2013-01-02 21:19:37 +020029class TestHeap:
Tim Petersaa7d2432002-08-03 02:11:26 +000030
Raymond Hettingerbce036b2004-06-10 05:07:18 +000031 def test_push_pop(self):
32 # 1) Push 256 random numbers and pop them off, verifying all's OK.
33 heap = []
34 data = []
35 self.check_invariant(heap)
36 for i in range(256):
37 item = random.random()
38 data.append(item)
Christian Heimesd3eb5a152008-02-24 00:38:49 +000039 self.module.heappush(heap, item)
Raymond Hettingerbce036b2004-06-10 05:07:18 +000040 self.check_invariant(heap)
41 results = []
42 while heap:
Christian Heimesd3eb5a152008-02-24 00:38:49 +000043 item = self.module.heappop(heap)
Raymond Hettingerbce036b2004-06-10 05:07:18 +000044 self.check_invariant(heap)
45 results.append(item)
46 data_sorted = data[:]
47 data_sorted.sort()
48 self.assertEqual(data_sorted, results)
49 # 2) Check that the invariant holds for a sorted array
50 self.check_invariant(results)
51
Christian Heimesd3eb5a152008-02-24 00:38:49 +000052 self.assertRaises(TypeError, self.module.heappush, [])
Raymond Hettingere1defa42004-11-29 05:54:48 +000053 try:
Christian Heimesd3eb5a152008-02-24 00:38:49 +000054 self.assertRaises(TypeError, self.module.heappush, None, None)
55 self.assertRaises(TypeError, self.module.heappop, None)
Raymond Hettingere1defa42004-11-29 05:54:48 +000056 except AttributeError:
57 pass
Neal Norwitzd7be1182004-07-08 01:56:46 +000058
Raymond Hettingerbce036b2004-06-10 05:07:18 +000059 def check_invariant(self, heap):
60 # Check the heap invariant.
61 for pos, item in enumerate(heap):
62 if pos: # pos 0 has no parent
63 parentpos = (pos-1) >> 1
Benjamin Petersonc9c0f202009-06-30 23:06:06 +000064 self.assertTrue(heap[parentpos] <= item)
Raymond Hettingerbce036b2004-06-10 05:07:18 +000065
66 def test_heapify(self):
67 for size in range(30):
68 heap = [random.random() for dummy in range(size)]
Christian Heimesd3eb5a152008-02-24 00:38:49 +000069 self.module.heapify(heap)
Raymond Hettingerbce036b2004-06-10 05:07:18 +000070 self.check_invariant(heap)
71
Christian Heimesd3eb5a152008-02-24 00:38:49 +000072 self.assertRaises(TypeError, self.module.heapify, None)
Neal Norwitzd7be1182004-07-08 01:56:46 +000073
Raymond Hettingerbce036b2004-06-10 05:07:18 +000074 def test_naive_nbest(self):
75 data = [random.randrange(2000) for i in range(1000)]
76 heap = []
77 for item in data:
Christian Heimesd3eb5a152008-02-24 00:38:49 +000078 self.module.heappush(heap, item)
Raymond Hettingerbce036b2004-06-10 05:07:18 +000079 if len(heap) > 10:
Christian Heimesd3eb5a152008-02-24 00:38:49 +000080 self.module.heappop(heap)
Raymond Hettingerbce036b2004-06-10 05:07:18 +000081 heap.sort()
82 self.assertEqual(heap, sorted(data)[-10:])
83
Christian Heimesd3eb5a152008-02-24 00:38:49 +000084 def heapiter(self, heap):
85 # An iterator returning a heap's elements, smallest-first.
86 try:
87 while 1:
88 yield self.module.heappop(heap)
89 except IndexError:
90 pass
91
Raymond Hettingerbce036b2004-06-10 05:07:18 +000092 def test_nbest(self):
93 # Less-naive "N-best" algorithm, much faster (if len(data) is big
94 # enough <wink>) than sorting all of data. However, if we had a max
95 # heap instead of a min heap, it could go faster still via
96 # heapify'ing all of data (linear time), then doing 10 heappops
97 # (10 log-time steps).
98 data = [random.randrange(2000) for i in range(1000)]
99 heap = data[:10]
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000100 self.module.heapify(heap)
Raymond Hettingerbce036b2004-06-10 05:07:18 +0000101 for item in data[10:]:
102 if item > heap[0]: # this gets rarer the longer we run
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000103 self.module.heapreplace(heap, item)
104 self.assertEqual(list(self.heapiter(heap)), sorted(data)[-10:])
Raymond Hettingerbce036b2004-06-10 05:07:18 +0000105
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000106 self.assertRaises(TypeError, self.module.heapreplace, None)
107 self.assertRaises(TypeError, self.module.heapreplace, None, None)
108 self.assertRaises(IndexError, self.module.heapreplace, [], None)
Neal Norwitzd7be1182004-07-08 01:56:46 +0000109
Christian Heimesdd15f6c2008-03-16 00:07:10 +0000110 def test_nbest_with_pushpop(self):
111 data = [random.randrange(2000) for i in range(1000)]
112 heap = data[:10]
113 self.module.heapify(heap)
114 for item in data[10:]:
115 self.module.heappushpop(heap, item)
116 self.assertEqual(list(self.heapiter(heap)), sorted(data)[-10:])
117 self.assertEqual(self.module.heappushpop([], 'x'), 'x')
118
119 def test_heappushpop(self):
120 h = []
121 x = self.module.heappushpop(h, 10)
122 self.assertEqual((h, x), ([], 10))
123
124 h = [10]
125 x = self.module.heappushpop(h, 10.0)
126 self.assertEqual((h, x), ([10], 10.0))
127 self.assertEqual(type(h[0]), int)
128 self.assertEqual(type(x), float)
129
130 h = [10];
131 x = self.module.heappushpop(h, 9)
132 self.assertEqual((h, x), ([10], 9))
133
134 h = [10];
135 x = self.module.heappushpop(h, 11)
136 self.assertEqual((h, x), ([11], 10))
137
Raymond Hettingerbce036b2004-06-10 05:07:18 +0000138 def test_heapsort(self):
139 # Exercise everything with repeated heapsort checks
Guido van Rossum805365e2007-05-07 22:24:25 +0000140 for trial in range(100):
Raymond Hettingerbce036b2004-06-10 05:07:18 +0000141 size = random.randrange(50)
142 data = [random.randrange(25) for i in range(size)]
143 if trial & 1: # Half of the time, use heapify
144 heap = data[:]
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000145 self.module.heapify(heap)
Raymond Hettingerbce036b2004-06-10 05:07:18 +0000146 else: # The rest of the time, use heappush
147 heap = []
148 for item in data:
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000149 self.module.heappush(heap, item)
150 heap_sorted = [self.module.heappop(heap) for i in range(size)]
Raymond Hettingerbce036b2004-06-10 05:07:18 +0000151 self.assertEqual(heap_sorted, sorted(data))
152
Thomas Wouterscf297e42007-02-23 15:07:44 +0000153 def test_merge(self):
154 inputs = []
Guido van Rossum805365e2007-05-07 22:24:25 +0000155 for i in range(random.randrange(5)):
Thomas Wouterscf297e42007-02-23 15:07:44 +0000156 row = sorted(random.randrange(1000) for j in range(random.randrange(10)))
157 inputs.append(row)
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000158 self.assertEqual(sorted(chain(*inputs)), list(self.module.merge(*inputs)))
159 self.assertEqual(list(self.module.merge()), [])
Thomas Wouterscf297e42007-02-23 15:07:44 +0000160
Raymond Hettinger46f5ca32013-09-14 20:51:57 -0700161 def test_merge_does_not_suppress_index_error(self):
162 # Issue 19018: Heapq.merge suppresses IndexError from user generator
163 def iterable():
164 s = list(range(10))
165 for i in range(20):
166 yield s[i] # IndexError when i > 10
167 with self.assertRaises(IndexError):
168 list(self.module.merge(iterable(), iterable()))
169
Thomas Wouterscf297e42007-02-23 15:07:44 +0000170 def test_merge_stability(self):
171 class Int(int):
172 pass
173 inputs = [[], [], [], []]
174 for i in range(20000):
175 stream = random.randrange(4)
176 x = random.randrange(500)
177 obj = Int(x)
178 obj.pair = (x, stream)
179 inputs[stream].append(obj)
180 for stream in inputs:
181 stream.sort()
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000182 result = [i.pair for i in self.module.merge(*inputs)]
Thomas Wouterscf297e42007-02-23 15:07:44 +0000183 self.assertEqual(result, sorted(result))
184
Raymond Hettingerbce036b2004-06-10 05:07:18 +0000185 def test_nsmallest(self):
Thomas Wouters902d6eb2007-01-09 23:18:33 +0000186 data = [(random.randrange(2000), i) for i in range(1000)]
187 for f in (None, lambda x: x[0] * 547 % 2000):
188 for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100):
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000189 self.assertEqual(list(self.module.nsmallest(n, data)),
190 sorted(data)[:n])
191 self.assertEqual(list(self.module.nsmallest(n, data, key=f)),
Thomas Wouters902d6eb2007-01-09 23:18:33 +0000192 sorted(data, key=f)[:n])
Raymond Hettingerbce036b2004-06-10 05:07:18 +0000193
Raymond Hettinger4901a1f2004-12-02 08:59:14 +0000194 def test_nlargest(self):
Thomas Wouters902d6eb2007-01-09 23:18:33 +0000195 data = [(random.randrange(2000), i) for i in range(1000)]
196 for f in (None, lambda x: x[0] * 547 % 2000):
197 for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100):
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000198 self.assertEqual(list(self.module.nlargest(n, data)),
Guido van Rossumc1f779c2007-07-03 08:25:58 +0000199 sorted(data, reverse=True)[:n])
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000200 self.assertEqual(list(self.module.nlargest(n, data, key=f)),
Thomas Wouters902d6eb2007-01-09 23:18:33 +0000201 sorted(data, key=f, reverse=True)[:n])
Tim Petersaa7d2432002-08-03 02:11:26 +0000202
Amaury Forgeot d'Arcfdfe62d2008-06-17 20:36:03 +0000203 def test_comparison_operator(self):
Ezio Melottif9756c22011-05-09 18:36:53 +0300204 # Issue 3051: Make sure heapq works with both __lt__
Amaury Forgeot d'Arc2ba198d2008-06-17 21:25:35 +0000205 # For python 3.0, __le__ alone is not enough
Amaury Forgeot d'Arcfdfe62d2008-06-17 20:36:03 +0000206 def hsort(data, comp):
207 data = [comp(x) for x in data]
208 self.module.heapify(data)
209 return [self.module.heappop(data).x for i in range(len(data))]
210 class LT:
211 def __init__(self, x):
212 self.x = x
213 def __lt__(self, other):
214 return self.x > other.x
215 class LE:
216 def __init__(self, x):
217 self.x = x
Amaury Forgeot d'Arc35c86582008-06-17 21:11:29 +0000218 def __le__(self, other):
Amaury Forgeot d'Arcfdfe62d2008-06-17 20:36:03 +0000219 return self.x >= other.x
220 data = [random.random() for i in range(100)]
221 target = sorted(data, reverse=True)
222 self.assertEqual(hsort(data, LT), target)
Amaury Forgeot d'Arc2ba198d2008-06-17 21:25:35 +0000223 self.assertRaises(TypeError, data, LE)
Amaury Forgeot d'Arcfdfe62d2008-06-17 20:36:03 +0000224
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000225
Ezio Melotti22ebb2d2013-01-02 21:19:37 +0200226class TestHeapPython(TestHeap, TestCase):
Ezio Melottif9756c22011-05-09 18:36:53 +0300227 module = py_heapq
228
229
230@skipUnless(c_heapq, 'requires _heapq')
Ezio Melotti22ebb2d2013-01-02 21:19:37 +0200231class TestHeapC(TestHeap, TestCase):
Ezio Melottif9756c22011-05-09 18:36:53 +0300232 module = c_heapq
233
234
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000235#==============================================================================
236
237class LenOnly:
238 "Dummy sequence class defining __len__ but not __getitem__."
239 def __len__(self):
240 return 10
241
242class GetOnly:
243 "Dummy sequence class defining __getitem__ but not __len__."
244 def __getitem__(self, ndx):
245 return 10
246
247class CmpErr:
248 "Dummy element that always raises an error during comparison"
Mark Dickinsona56c4672009-01-27 18:17:45 +0000249 def __eq__(self, other):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000250 raise ZeroDivisionError
Mark Dickinsona56c4672009-01-27 18:17:45 +0000251 __ne__ = __lt__ = __le__ = __gt__ = __ge__ = __eq__
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000252
253def R(seqn):
254 'Regular generator'
255 for i in seqn:
256 yield i
257
258class G:
259 'Sequence using __getitem__'
260 def __init__(self, seqn):
261 self.seqn = seqn
262 def __getitem__(self, i):
263 return self.seqn[i]
264
265class I:
266 'Sequence using iterator protocol'
267 def __init__(self, seqn):
268 self.seqn = seqn
269 self.i = 0
270 def __iter__(self):
271 return self
Georg Brandla18af4e2007-04-21 15:47:16 +0000272 def __next__(self):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000273 if self.i >= len(self.seqn): raise StopIteration
274 v = self.seqn[self.i]
275 self.i += 1
276 return v
277
278class Ig:
279 'Sequence using iterator protocol defined with a generator'
280 def __init__(self, seqn):
281 self.seqn = seqn
282 self.i = 0
283 def __iter__(self):
284 for val in self.seqn:
285 yield val
286
287class X:
288 'Missing __getitem__ and __iter__'
289 def __init__(self, seqn):
290 self.seqn = seqn
291 self.i = 0
Georg Brandla18af4e2007-04-21 15:47:16 +0000292 def __next__(self):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000293 if self.i >= len(self.seqn): raise StopIteration
294 v = self.seqn[self.i]
295 self.i += 1
296 return v
297
298class N:
Georg Brandla18af4e2007-04-21 15:47:16 +0000299 'Iterator missing __next__()'
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000300 def __init__(self, seqn):
301 self.seqn = seqn
302 self.i = 0
303 def __iter__(self):
304 return self
305
306class E:
307 'Test propagation of exceptions'
308 def __init__(self, seqn):
309 self.seqn = seqn
310 self.i = 0
311 def __iter__(self):
312 return self
Georg Brandla18af4e2007-04-21 15:47:16 +0000313 def __next__(self):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000314 3 // 0
315
316class S:
317 'Test immediate stop'
318 def __init__(self, seqn):
319 pass
320 def __iter__(self):
321 return self
Georg Brandla18af4e2007-04-21 15:47:16 +0000322 def __next__(self):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000323 raise StopIteration
324
Raymond Hettinger736c0ab2008-03-13 02:09:15 +0000325from itertools import chain
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000326def L(seqn):
327 'Test multiple tiers of iterators'
Raymond Hettingera6c60372008-03-13 01:26:19 +0000328 return chain(map(lambda x:x, R(Ig(G(seqn)))))
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000329
Ezio Melotti8269a442011-05-09 07:15:04 +0300330
Antoine Pitrou44d52142013-03-04 20:30:01 +0100331class SideEffectLT:
332 def __init__(self, value, heap):
333 self.value = value
334 self.heap = heap
335
336 def __lt__(self, other):
337 self.heap[:] = []
338 return self.value < other.value
339
340
Ezio Melotti22ebb2d2013-01-02 21:19:37 +0200341class TestErrorHandling:
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000342
343 def test_non_sequence(self):
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000344 for f in (self.module.heapify, self.module.heappop):
Raymond Hettinger8a9c4d92011-04-13 11:49:57 -0700345 self.assertRaises((TypeError, AttributeError), f, 10)
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000346 for f in (self.module.heappush, self.module.heapreplace,
347 self.module.nlargest, self.module.nsmallest):
Raymond Hettinger8a9c4d92011-04-13 11:49:57 -0700348 self.assertRaises((TypeError, AttributeError), f, 10, 10)
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000349
350 def test_len_only(self):
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000351 for f in (self.module.heapify, self.module.heappop):
Raymond Hettinger8a9c4d92011-04-13 11:49:57 -0700352 self.assertRaises((TypeError, AttributeError), f, LenOnly())
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000353 for f in (self.module.heappush, self.module.heapreplace):
Raymond Hettinger8a9c4d92011-04-13 11:49:57 -0700354 self.assertRaises((TypeError, AttributeError), f, LenOnly(), 10)
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000355 for f in (self.module.nlargest, self.module.nsmallest):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000356 self.assertRaises(TypeError, f, 2, LenOnly())
357
358 def test_get_only(self):
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000359 for f in (self.module.heapify, self.module.heappop):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000360 self.assertRaises(TypeError, f, GetOnly())
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000361 for f in (self.module.heappush, self.module.heapreplace):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000362 self.assertRaises(TypeError, f, GetOnly(), 10)
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000363 for f in (self.module.nlargest, self.module.nsmallest):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000364 self.assertRaises(TypeError, f, 2, GetOnly())
365
366 def test_get_only(self):
367 seq = [CmpErr(), CmpErr(), CmpErr()]
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000368 for f in (self.module.heapify, self.module.heappop):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000369 self.assertRaises(ZeroDivisionError, f, seq)
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000370 for f in (self.module.heappush, self.module.heapreplace):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000371 self.assertRaises(ZeroDivisionError, f, seq, 10)
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000372 for f in (self.module.nlargest, self.module.nsmallest):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000373 self.assertRaises(ZeroDivisionError, f, 2, seq)
374
375 def test_arg_parsing(self):
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000376 for f in (self.module.heapify, self.module.heappop,
377 self.module.heappush, self.module.heapreplace,
378 self.module.nlargest, self.module.nsmallest):
Raymond Hettinger8a9c4d92011-04-13 11:49:57 -0700379 self.assertRaises((TypeError, AttributeError), f, 10)
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000380
381 def test_iterable_args(self):
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000382 for f in (self.module.nlargest, self.module.nsmallest):
Guido van Rossum805365e2007-05-07 22:24:25 +0000383 for s in ("123", "", range(1000), (1, 1.2), range(2000,2200,5)):
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000384 for g in (G, I, Ig, L, R):
Guido van Rossumc1f779c2007-07-03 08:25:58 +0000385 self.assertEqual(list(f(2, g(s))), list(f(2,s)))
386 self.assertEqual(list(f(2, S(s))), [])
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000387 self.assertRaises(TypeError, f, 2, X(s))
388 self.assertRaises(TypeError, f, 2, N(s))
389 self.assertRaises(ZeroDivisionError, f, 2, E(s))
390
Antoine Pitrou44d52142013-03-04 20:30:01 +0100391 # Issue #17278: the heap may change size while it's being walked.
392
393 def test_heappush_mutating_heap(self):
394 heap = []
395 heap.extend(SideEffectLT(i, heap) for i in range(200))
396 # Python version raises IndexError, C version RuntimeError
397 with self.assertRaises((IndexError, RuntimeError)):
398 self.module.heappush(heap, SideEffectLT(5, heap))
399
400 def test_heappop_mutating_heap(self):
401 heap = []
402 heap.extend(SideEffectLT(i, heap) for i in range(200))
403 # Python version raises IndexError, C version RuntimeError
404 with self.assertRaises((IndexError, RuntimeError)):
405 self.module.heappop(heap)
406
Christian Heimesd3eb5a152008-02-24 00:38:49 +0000407
Ezio Melotti22ebb2d2013-01-02 21:19:37 +0200408class TestErrorHandlingPython(TestErrorHandling, TestCase):
Ezio Melottifd69abb2011-05-09 07:20:47 +0300409 module = py_heapq
410
Ezio Melotti19f7ca22011-05-09 07:27:20 +0300411@skipUnless(c_heapq, 'requires _heapq')
Ezio Melotti22ebb2d2013-01-02 21:19:37 +0200412class TestErrorHandlingC(TestErrorHandling, TestCase):
Ezio Melottifd69abb2011-05-09 07:20:47 +0300413 module = c_heapq
414
Raymond Hettinger855d9a92004-09-28 00:03:54 +0000415
Guido van Rossum0b191782002-08-02 18:29:53 +0000416if __name__ == "__main__":
Ezio Melotti22ebb2d2013-01-02 21:19:37 +0200417 unittest.main()