blob: 13926e1df3621e7a24b7ee918d44ccccfba79cd3 [file] [log] [blame]
Guido van Rossum7d9ea502003-02-03 20:45:52 +00001import unittest
2from test import test_support
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +00003import zlib
Andrew M. Kuchling9a0f98e2001-02-21 02:17:01 +00004import random
Andrew M. Kuchling9a0f98e2001-02-21 02:17:01 +00005
Andrew M. Kuchling9a0f98e2001-02-21 02:17:01 +00006
Guido van Rossum7d9ea502003-02-03 20:45:52 +00007class ChecksumTestCase(unittest.TestCase):
8 # checksum test cases
9 def test_crc32start(self):
10 self.assertEqual(zlib.crc32(""), zlib.crc32("", 0))
Andrew M. Kuchlingbb7e8002005-11-22 15:32:28 +000011 self.assert_(zlib.crc32("abc", 0xffffffff))
Andrew M. Kuchlingfcfc8d52001-08-10 15:50:11 +000012
Guido van Rossum7d9ea502003-02-03 20:45:52 +000013 def test_crc32empty(self):
14 self.assertEqual(zlib.crc32("", 0), 0)
15 self.assertEqual(zlib.crc32("", 1), 1)
16 self.assertEqual(zlib.crc32("", 432), 432)
Andrew M. Kuchling9a0f98e2001-02-21 02:17:01 +000017
Guido van Rossum7d9ea502003-02-03 20:45:52 +000018 def test_adler32start(self):
19 self.assertEqual(zlib.adler32(""), zlib.adler32("", 1))
Andrew M. Kuchlingbb7e8002005-11-22 15:32:28 +000020 self.assert_(zlib.adler32("abc", 0xffffffff))
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +000021
Guido van Rossum7d9ea502003-02-03 20:45:52 +000022 def test_adler32empty(self):
23 self.assertEqual(zlib.adler32("", 0), 0)
24 self.assertEqual(zlib.adler32("", 1), 1)
25 self.assertEqual(zlib.adler32("", 432), 432)
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +000026
Guido van Rossum7d9ea502003-02-03 20:45:52 +000027 def assertEqual32(self, seen, expected):
28 # 32-bit values masked -- checksums on 32- vs 64- bit machines
29 # This is important if bit 31 (0x08000000L) is set.
30 self.assertEqual(seen & 0x0FFFFFFFFL, expected & 0x0FFFFFFFFL)
31
32 def test_penguins(self):
33 self.assertEqual32(zlib.crc32("penguin", 0), 0x0e5c1a120L)
34 self.assertEqual32(zlib.crc32("penguin", 1), 0x43b6aa94)
35 self.assertEqual32(zlib.adler32("penguin", 0), 0x0bcf02f6)
36 self.assertEqual32(zlib.adler32("penguin", 1), 0x0bd602f7)
37
38 self.assertEqual(zlib.crc32("penguin"), zlib.crc32("penguin", 0))
39 self.assertEqual(zlib.adler32("penguin"),zlib.adler32("penguin",1))
40
41
42
43class ExceptionTestCase(unittest.TestCase):
44 # make sure we generate some expected errors
Armin Rigoec560192007-10-15 07:48:35 +000045 def test_badlevel(self):
46 # specifying compression level out of range causes an error
47 # (but -1 is Z_DEFAULT_COMPRESSION and apparently the zlib
48 # accepts 0 too)
49 self.assertRaises(zlib.error, zlib.compress, 'ERROR', 10)
Guido van Rossum7d9ea502003-02-03 20:45:52 +000050
51 def test_badcompressobj(self):
52 # verify failure on building compress object with bad params
Neil Schemenauer94afd3e2004-06-05 19:02:52 +000053 self.assertRaises(ValueError, zlib.compressobj, 1, zlib.DEFLATED, 0)
Armin Rigoec560192007-10-15 07:48:35 +000054 # specifying total bits too large causes an error
55 self.assertRaises(ValueError,
56 zlib.compressobj, 1, zlib.DEFLATED, zlib.MAX_WBITS + 1)
Guido van Rossum7d9ea502003-02-03 20:45:52 +000057
58 def test_baddecompressobj(self):
59 # verify failure on building decompress object with bad params
60 self.assertRaises(ValueError, zlib.decompressobj, 0)
61
62
63
64class CompressTestCase(unittest.TestCase):
65 # Test compression in one go (whole message compression)
66 def test_speech(self):
Neil Schemenauer6412b122004-06-05 19:34:28 +000067 x = zlib.compress(HAMLET_SCENE)
68 self.assertEqual(zlib.decompress(x), HAMLET_SCENE)
Guido van Rossum7d9ea502003-02-03 20:45:52 +000069
70 def test_speech128(self):
Neil Schemenauer6412b122004-06-05 19:34:28 +000071 # compress more data
72 data = HAMLET_SCENE * 128
Guido van Rossum7d9ea502003-02-03 20:45:52 +000073 x = zlib.compress(data)
74 self.assertEqual(zlib.decompress(x), data)
75
Guido van Rossum7d9ea502003-02-03 20:45:52 +000076
77
78
79class CompressObjectTestCase(unittest.TestCase):
80 # Test compression object
Guido van Rossum7d9ea502003-02-03 20:45:52 +000081 def test_pair(self):
Neil Schemenauer6412b122004-06-05 19:34:28 +000082 # straightforward compress/decompress objects
83 data = HAMLET_SCENE * 128
84 co = zlib.compressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +000085 x1 = co.compress(data)
86 x2 = co.flush()
87 self.assertRaises(zlib.error, co.flush) # second flush should not work
Neil Schemenauer94afd3e2004-06-05 19:02:52 +000088 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +000089 y1 = dco.decompress(x1 + x2)
90 y2 = dco.flush()
91 self.assertEqual(data, y1 + y2)
92
Neil Schemenauer94afd3e2004-06-05 19:02:52 +000093 def test_compressoptions(self):
94 # specify lots of options to compressobj()
95 level = 2
96 method = zlib.DEFLATED
97 wbits = -12
98 memlevel = 9
99 strategy = zlib.Z_FILTERED
100 co = zlib.compressobj(level, method, wbits, memlevel, strategy)
Neil Schemenauer6412b122004-06-05 19:34:28 +0000101 x1 = co.compress(HAMLET_SCENE)
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000102 x2 = co.flush()
103 dco = zlib.decompressobj(wbits)
104 y1 = dco.decompress(x1 + x2)
105 y2 = dco.flush()
Neil Schemenauer6412b122004-06-05 19:34:28 +0000106 self.assertEqual(HAMLET_SCENE, y1 + y2)
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000107
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000108 def test_compressincremental(self):
109 # compress object in steps, decompress object as one-shot
Neil Schemenauer6412b122004-06-05 19:34:28 +0000110 data = HAMLET_SCENE * 128
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000111 co = zlib.compressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000112 bufs = []
113 for i in range(0, len(data), 256):
114 bufs.append(co.compress(data[i:i+256]))
115 bufs.append(co.flush())
116 combuf = ''.join(bufs)
117
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000118 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000119 y1 = dco.decompress(''.join(bufs))
120 y2 = dco.flush()
121 self.assertEqual(data, y1 + y2)
122
Neil Schemenauer6412b122004-06-05 19:34:28 +0000123 def test_decompinc(self, flush=False, source=None, cx=256, dcx=64):
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000124 # compress object in steps, decompress object in steps
Neil Schemenauer6412b122004-06-05 19:34:28 +0000125 source = source or HAMLET_SCENE
126 data = source * 128
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000127 co = zlib.compressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000128 bufs = []
Neil Schemenauer6412b122004-06-05 19:34:28 +0000129 for i in range(0, len(data), cx):
130 bufs.append(co.compress(data[i:i+cx]))
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000131 bufs.append(co.flush())
132 combuf = ''.join(bufs)
133
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000134 self.assertEqual(data, zlib.decompress(combuf))
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000135
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000136 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000137 bufs = []
Neil Schemenauer6412b122004-06-05 19:34:28 +0000138 for i in range(0, len(combuf), dcx):
139 bufs.append(dco.decompress(combuf[i:i+dcx]))
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000140 self.assertEqual('', dco.unconsumed_tail, ########
141 "(A) uct should be '': not %d long" %
Neil Schemenauer6412b122004-06-05 19:34:28 +0000142 len(dco.unconsumed_tail))
143 if flush:
144 bufs.append(dco.flush())
145 else:
146 while True:
147 chunk = dco.decompress('')
148 if chunk:
149 bufs.append(chunk)
150 else:
151 break
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000152 self.assertEqual('', dco.unconsumed_tail, ########
Neil Schemenauer6412b122004-06-05 19:34:28 +0000153 "(B) uct should be '': not %d long" %
154 len(dco.unconsumed_tail))
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000155 self.assertEqual(data, ''.join(bufs))
156 # Failure means: "decompressobj with init options failed"
157
Neil Schemenauer6412b122004-06-05 19:34:28 +0000158 def test_decompincflush(self):
159 self.test_decompinc(flush=True)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000160
Neil Schemenauer6412b122004-06-05 19:34:28 +0000161 def test_decompimax(self, source=None, cx=256, dcx=64):
162 # compress in steps, decompress in length-restricted steps
163 source = source or HAMLET_SCENE
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000164 # Check a decompression object with max_length specified
Neil Schemenauer6412b122004-06-05 19:34:28 +0000165 data = source * 128
166 co = zlib.compressobj()
167 bufs = []
168 for i in range(0, len(data), cx):
169 bufs.append(co.compress(data[i:i+cx]))
170 bufs.append(co.flush())
171 combuf = ''.join(bufs)
172 self.assertEqual(data, zlib.decompress(combuf),
173 'compressed data failure')
174
175 dco = zlib.decompressobj()
176 bufs = []
177 cb = combuf
178 while cb:
179 #max_length = 1 + len(cb)//10
180 chunk = dco.decompress(cb, dcx)
181 self.failIf(len(chunk) > dcx,
182 'chunk too big (%d>%d)' % (len(chunk), dcx))
183 bufs.append(chunk)
184 cb = dco.unconsumed_tail
185 bufs.append(dco.flush())
186 self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved')
187
188 def test_decompressmaxlen(self, flush=False):
189 # Check a decompression object with max_length specified
190 data = HAMLET_SCENE * 128
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000191 co = zlib.compressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000192 bufs = []
193 for i in range(0, len(data), 256):
194 bufs.append(co.compress(data[i:i+256]))
195 bufs.append(co.flush())
196 combuf = ''.join(bufs)
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000197 self.assertEqual(data, zlib.decompress(combuf),
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000198 'compressed data failure')
199
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000200 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000201 bufs = []
202 cb = combuf
203 while cb:
Guido van Rossumf3594102003-02-27 18:39:18 +0000204 max_length = 1 + len(cb)//10
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000205 chunk = dco.decompress(cb, max_length)
206 self.failIf(len(chunk) > max_length,
207 'chunk too big (%d>%d)' % (len(chunk),max_length))
208 bufs.append(chunk)
209 cb = dco.unconsumed_tail
Neil Schemenauer6412b122004-06-05 19:34:28 +0000210 if flush:
211 bufs.append(dco.flush())
212 else:
213 while chunk:
214 chunk = dco.decompress('', max_length)
215 self.failIf(len(chunk) > max_length,
216 'chunk too big (%d>%d)' % (len(chunk),max_length))
217 bufs.append(chunk)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000218 self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved')
219
Neil Schemenauer6412b122004-06-05 19:34:28 +0000220 def test_decompressmaxlenflush(self):
221 self.test_decompressmaxlen(flush=True)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000222
223 def test_maxlenmisc(self):
224 # Misc tests of max_length
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000225 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000226 self.assertRaises(ValueError, dco.decompress, "", -1)
227 self.assertEqual('', dco.unconsumed_tail)
228
229 def test_flushes(self):
230 # Test flush() with the various options, using all the
231 # different levels in order to provide more variations.
232 sync_opt = ['Z_NO_FLUSH', 'Z_SYNC_FLUSH', 'Z_FULL_FLUSH']
233 sync_opt = [getattr(zlib, opt) for opt in sync_opt
234 if hasattr(zlib, opt)]
Neil Schemenauer6412b122004-06-05 19:34:28 +0000235 data = HAMLET_SCENE * 8
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000236
237 for sync in sync_opt:
238 for level in range(10):
239 obj = zlib.compressobj( level )
240 a = obj.compress( data[:3000] )
241 b = obj.flush( sync )
242 c = obj.compress( data[3000:] )
243 d = obj.flush()
244 self.assertEqual(zlib.decompress(''.join([a,b,c,d])),
245 data, ("Decompress failed: flush "
246 "mode=%i, level=%i") % (sync, level))
247 del obj
248
249 def test_odd_flush(self):
250 # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1
251 import random
252
253 if hasattr(zlib, 'Z_SYNC_FLUSH'):
254 # Testing on 17K of "random" data
255
256 # Create compressor and decompressor objects
Neil Schemenauer6412b122004-06-05 19:34:28 +0000257 co = zlib.compressobj(zlib.Z_BEST_COMPRESSION)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000258 dco = zlib.decompressobj()
259
260 # Try 17K of data
261 # generate random data stream
262 try:
263 # In 2.3 and later, WichmannHill is the RNG of the bug report
264 gen = random.WichmannHill()
265 except AttributeError:
266 try:
267 # 2.2 called it Random
268 gen = random.Random()
269 except AttributeError:
270 # others might simply have a single RNG
271 gen = random
272 gen.seed(1)
273 data = genblock(1, 17 * 1024, generator=gen)
274
275 # compress, sync-flush, and decompress
276 first = co.compress(data)
277 second = co.flush(zlib.Z_SYNC_FLUSH)
278 expanded = dco.decompress(first + second)
279
280 # if decompressed data is different from the input data, choke.
281 self.assertEqual(expanded, data, "17K random source doesn't match")
282
Andrew M. Kuchling3b585b32004-12-28 20:10:48 +0000283 def test_empty_flush(self):
284 # Test that calling .flush() on unused objects works.
285 # (Bug #1083110 -- calling .flush() on decompress objects
286 # caused a core dump.)
287
288 co = zlib.compressobj(zlib.Z_BEST_COMPRESSION)
289 self.failUnless(co.flush()) # Returns a zlib header
290 dco = zlib.decompressobj()
291 self.assertEqual(dco.flush(), "") # Returns nothing
Tim Peters5a9fb3c2005-01-07 16:01:32 +0000292
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000293 if hasattr(zlib.compressobj(), "copy"):
294 def test_compresscopy(self):
295 # Test copying a compression object
296 data0 = HAMLET_SCENE
297 data1 = HAMLET_SCENE.swapcase()
298 c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION)
299 bufs0 = []
300 bufs0.append(c0.compress(data0))
Georg Brandl8d3342b2006-05-16 07:38:27 +0000301
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000302 c1 = c0.copy()
303 bufs1 = bufs0[:]
Georg Brandl8d3342b2006-05-16 07:38:27 +0000304
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000305 bufs0.append(c0.compress(data0))
306 bufs0.append(c0.flush())
307 s0 = ''.join(bufs0)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000308
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000309 bufs1.append(c1.compress(data1))
310 bufs1.append(c1.flush())
311 s1 = ''.join(bufs1)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000312
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000313 self.assertEqual(zlib.decompress(s0),data0+data0)
314 self.assertEqual(zlib.decompress(s1),data0+data1)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000315
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000316 def test_badcompresscopy(self):
317 # Test copying a compression object in an inconsistent state
318 c = zlib.compressobj()
319 c.compress(HAMLET_SCENE)
320 c.flush()
321 self.assertRaises(ValueError, c.copy)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000322
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000323 if hasattr(zlib.decompressobj(), "copy"):
324 def test_decompresscopy(self):
325 # Test copying a decompression object
326 data = HAMLET_SCENE
327 comp = zlib.compress(data)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000328
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000329 d0 = zlib.decompressobj()
330 bufs0 = []
331 bufs0.append(d0.decompress(comp[:32]))
Georg Brandl8d3342b2006-05-16 07:38:27 +0000332
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000333 d1 = d0.copy()
334 bufs1 = bufs0[:]
Georg Brandl8d3342b2006-05-16 07:38:27 +0000335
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000336 bufs0.append(d0.decompress(comp[32:]))
337 s0 = ''.join(bufs0)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000338
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000339 bufs1.append(d1.decompress(comp[32:]))
340 s1 = ''.join(bufs1)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000341
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000342 self.assertEqual(s0,s1)
343 self.assertEqual(s0,data)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000344
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000345 def test_baddecompresscopy(self):
346 # Test copying a compression object in an inconsistent state
347 data = zlib.compress(HAMLET_SCENE)
348 d = zlib.decompressobj()
349 d.decompress(data)
350 d.flush()
351 self.assertRaises(ValueError, d.copy)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000352
353def genblock(seed, length, step=1024, generator=random):
354 """length-byte stream of random data from a seed (in step-byte blocks)."""
355 if seed is not None:
356 generator.seed(seed)
357 randint = generator.randint
358 if length < step or step < 2:
359 step = length
360 blocks = []
361 for i in range(0, length, step):
362 blocks.append(''.join([chr(randint(0,255))
363 for x in range(step)]))
364 return ''.join(blocks)[:length]
365
366
367
368def choose_lines(source, number, seed=None, generator=random):
369 """Return a list of number lines randomly chosen from the source"""
370 if seed is not None:
371 generator.seed(seed)
372 sources = source.split('\n')
373 return [generator.choice(sources) for n in range(number)]
374
375
376
Neil Schemenauer6412b122004-06-05 19:34:28 +0000377HAMLET_SCENE = """
Fred Drake004d5e62000-10-23 17:22:08 +0000378LAERTES
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000379
380 O, fear me not.
381 I stay too long: but here my father comes.
382
383 Enter POLONIUS
384
385 A double blessing is a double grace,
386 Occasion smiles upon a second leave.
387
Fred Drake004d5e62000-10-23 17:22:08 +0000388LORD POLONIUS
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000389
390 Yet here, Laertes! aboard, aboard, for shame!
391 The wind sits in the shoulder of your sail,
392 And you are stay'd for. There; my blessing with thee!
393 And these few precepts in thy memory
394 See thou character. Give thy thoughts no tongue,
395 Nor any unproportioned thought his act.
396 Be thou familiar, but by no means vulgar.
397 Those friends thou hast, and their adoption tried,
398 Grapple them to thy soul with hoops of steel;
399 But do not dull thy palm with entertainment
400 Of each new-hatch'd, unfledged comrade. Beware
401 Of entrance to a quarrel, but being in,
402 Bear't that the opposed may beware of thee.
403 Give every man thy ear, but few thy voice;
404 Take each man's censure, but reserve thy judgment.
405 Costly thy habit as thy purse can buy,
406 But not express'd in fancy; rich, not gaudy;
407 For the apparel oft proclaims the man,
408 And they in France of the best rank and station
409 Are of a most select and generous chief in that.
410 Neither a borrower nor a lender be;
411 For loan oft loses both itself and friend,
412 And borrowing dulls the edge of husbandry.
413 This above all: to thine ownself be true,
414 And it must follow, as the night the day,
415 Thou canst not then be false to any man.
416 Farewell: my blessing season this in thee!
417
Fred Drake004d5e62000-10-23 17:22:08 +0000418LAERTES
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000419
420 Most humbly do I take my leave, my lord.
421
Fred Drake004d5e62000-10-23 17:22:08 +0000422LORD POLONIUS
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000423
424 The time invites you; go; your servants tend.
425
Fred Drake004d5e62000-10-23 17:22:08 +0000426LAERTES
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000427
428 Farewell, Ophelia; and remember well
429 What I have said to you.
430
Fred Drake004d5e62000-10-23 17:22:08 +0000431OPHELIA
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000432
433 'Tis in my memory lock'd,
434 And you yourself shall keep the key of it.
435
Fred Drake004d5e62000-10-23 17:22:08 +0000436LAERTES
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000437
438 Farewell.
439"""
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000440
441
442def test_main():
Walter Dörwald21d3a322003-05-01 17:45:56 +0000443 test_support.run_unittest(
444 ChecksumTestCase,
445 ExceptionTestCase,
446 CompressTestCase,
447 CompressObjectTestCase
448 )
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000449
450if __name__ == "__main__":
451 test_main()