blob: 7c7ef263b310601350718ecff68b5f43769256c7 [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
Gregory P. Smithf48f9d32008-03-17 18:48:05 +000041 def test_abcdefghijklmnop(self):
42 """test issue1202 compliance: signed crc32, adler32 in 2.x"""
43 foo = 'abcdefghijklmnop'
44 # explicitly test signed behavior
45 self.assertEqual(zlib.crc32(foo), -1808088941)
46 self.assertEqual(zlib.crc32('spam'), 1138425661)
47 self.assertEqual(zlib.adler32(foo+foo), -721416943)
48 self.assertEqual(zlib.adler32('spam'), 72286642)
49
Guido van Rossum7d9ea502003-02-03 20:45:52 +000050
51
52class ExceptionTestCase(unittest.TestCase):
53 # make sure we generate some expected errors
Armin Rigoec560192007-10-15 07:48:35 +000054 def test_badlevel(self):
55 # specifying compression level out of range causes an error
56 # (but -1 is Z_DEFAULT_COMPRESSION and apparently the zlib
57 # accepts 0 too)
58 self.assertRaises(zlib.error, zlib.compress, 'ERROR', 10)
Guido van Rossum7d9ea502003-02-03 20:45:52 +000059
60 def test_badcompressobj(self):
61 # verify failure on building compress object with bad params
Neil Schemenauer94afd3e2004-06-05 19:02:52 +000062 self.assertRaises(ValueError, zlib.compressobj, 1, zlib.DEFLATED, 0)
Armin Rigoec560192007-10-15 07:48:35 +000063 # specifying total bits too large causes an error
64 self.assertRaises(ValueError,
65 zlib.compressobj, 1, zlib.DEFLATED, zlib.MAX_WBITS + 1)
Guido van Rossum7d9ea502003-02-03 20:45:52 +000066
67 def test_baddecompressobj(self):
68 # verify failure on building decompress object with bad params
69 self.assertRaises(ValueError, zlib.decompressobj, 0)
70
71
72
73class CompressTestCase(unittest.TestCase):
74 # Test compression in one go (whole message compression)
75 def test_speech(self):
Neil Schemenauer6412b122004-06-05 19:34:28 +000076 x = zlib.compress(HAMLET_SCENE)
77 self.assertEqual(zlib.decompress(x), HAMLET_SCENE)
Guido van Rossum7d9ea502003-02-03 20:45:52 +000078
79 def test_speech128(self):
Neil Schemenauer6412b122004-06-05 19:34:28 +000080 # compress more data
81 data = HAMLET_SCENE * 128
Guido van Rossum7d9ea502003-02-03 20:45:52 +000082 x = zlib.compress(data)
83 self.assertEqual(zlib.decompress(x), data)
84
Guido van Rossum7d9ea502003-02-03 20:45:52 +000085
86
87
88class CompressObjectTestCase(unittest.TestCase):
89 # Test compression object
Guido van Rossum7d9ea502003-02-03 20:45:52 +000090 def test_pair(self):
Neil Schemenauer6412b122004-06-05 19:34:28 +000091 # straightforward compress/decompress objects
92 data = HAMLET_SCENE * 128
93 co = zlib.compressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +000094 x1 = co.compress(data)
95 x2 = co.flush()
96 self.assertRaises(zlib.error, co.flush) # second flush should not work
Neil Schemenauer94afd3e2004-06-05 19:02:52 +000097 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +000098 y1 = dco.decompress(x1 + x2)
99 y2 = dco.flush()
100 self.assertEqual(data, y1 + y2)
101
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000102 def test_compressoptions(self):
103 # specify lots of options to compressobj()
104 level = 2
105 method = zlib.DEFLATED
106 wbits = -12
107 memlevel = 9
108 strategy = zlib.Z_FILTERED
109 co = zlib.compressobj(level, method, wbits, memlevel, strategy)
Neil Schemenauer6412b122004-06-05 19:34:28 +0000110 x1 = co.compress(HAMLET_SCENE)
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000111 x2 = co.flush()
112 dco = zlib.decompressobj(wbits)
113 y1 = dco.decompress(x1 + x2)
114 y2 = dco.flush()
Neil Schemenauer6412b122004-06-05 19:34:28 +0000115 self.assertEqual(HAMLET_SCENE, y1 + y2)
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000116
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000117 def test_compressincremental(self):
118 # compress object in steps, decompress object as one-shot
Neil Schemenauer6412b122004-06-05 19:34:28 +0000119 data = HAMLET_SCENE * 128
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000120 co = zlib.compressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000121 bufs = []
122 for i in range(0, len(data), 256):
123 bufs.append(co.compress(data[i:i+256]))
124 bufs.append(co.flush())
125 combuf = ''.join(bufs)
126
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000127 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000128 y1 = dco.decompress(''.join(bufs))
129 y2 = dco.flush()
130 self.assertEqual(data, y1 + y2)
131
Neil Schemenauer6412b122004-06-05 19:34:28 +0000132 def test_decompinc(self, flush=False, source=None, cx=256, dcx=64):
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000133 # compress object in steps, decompress object in steps
Neil Schemenauer6412b122004-06-05 19:34:28 +0000134 source = source or HAMLET_SCENE
135 data = source * 128
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000136 co = zlib.compressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000137 bufs = []
Neil Schemenauer6412b122004-06-05 19:34:28 +0000138 for i in range(0, len(data), cx):
139 bufs.append(co.compress(data[i:i+cx]))
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000140 bufs.append(co.flush())
141 combuf = ''.join(bufs)
142
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000143 self.assertEqual(data, zlib.decompress(combuf))
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000144
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000145 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000146 bufs = []
Neil Schemenauer6412b122004-06-05 19:34:28 +0000147 for i in range(0, len(combuf), dcx):
148 bufs.append(dco.decompress(combuf[i:i+dcx]))
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000149 self.assertEqual('', dco.unconsumed_tail, ########
150 "(A) uct should be '': not %d long" %
Neil Schemenauer6412b122004-06-05 19:34:28 +0000151 len(dco.unconsumed_tail))
152 if flush:
153 bufs.append(dco.flush())
154 else:
155 while True:
156 chunk = dco.decompress('')
157 if chunk:
158 bufs.append(chunk)
159 else:
160 break
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000161 self.assertEqual('', dco.unconsumed_tail, ########
Neil Schemenauer6412b122004-06-05 19:34:28 +0000162 "(B) uct should be '': not %d long" %
163 len(dco.unconsumed_tail))
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000164 self.assertEqual(data, ''.join(bufs))
165 # Failure means: "decompressobj with init options failed"
166
Neil Schemenauer6412b122004-06-05 19:34:28 +0000167 def test_decompincflush(self):
168 self.test_decompinc(flush=True)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000169
Neil Schemenauer6412b122004-06-05 19:34:28 +0000170 def test_decompimax(self, source=None, cx=256, dcx=64):
171 # compress in steps, decompress in length-restricted steps
172 source = source or HAMLET_SCENE
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000173 # Check a decompression object with max_length specified
Neil Schemenauer6412b122004-06-05 19:34:28 +0000174 data = source * 128
175 co = zlib.compressobj()
176 bufs = []
177 for i in range(0, len(data), cx):
178 bufs.append(co.compress(data[i:i+cx]))
179 bufs.append(co.flush())
180 combuf = ''.join(bufs)
181 self.assertEqual(data, zlib.decompress(combuf),
182 'compressed data failure')
183
184 dco = zlib.decompressobj()
185 bufs = []
186 cb = combuf
187 while cb:
188 #max_length = 1 + len(cb)//10
189 chunk = dco.decompress(cb, dcx)
190 self.failIf(len(chunk) > dcx,
191 'chunk too big (%d>%d)' % (len(chunk), dcx))
192 bufs.append(chunk)
193 cb = dco.unconsumed_tail
194 bufs.append(dco.flush())
195 self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved')
196
197 def test_decompressmaxlen(self, flush=False):
198 # Check a decompression object with max_length specified
199 data = HAMLET_SCENE * 128
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000200 co = zlib.compressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000201 bufs = []
202 for i in range(0, len(data), 256):
203 bufs.append(co.compress(data[i:i+256]))
204 bufs.append(co.flush())
205 combuf = ''.join(bufs)
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000206 self.assertEqual(data, zlib.decompress(combuf),
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000207 'compressed data failure')
208
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000209 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000210 bufs = []
211 cb = combuf
212 while cb:
Guido van Rossumf3594102003-02-27 18:39:18 +0000213 max_length = 1 + len(cb)//10
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000214 chunk = dco.decompress(cb, max_length)
215 self.failIf(len(chunk) > max_length,
216 'chunk too big (%d>%d)' % (len(chunk),max_length))
217 bufs.append(chunk)
218 cb = dco.unconsumed_tail
Neil Schemenauer6412b122004-06-05 19:34:28 +0000219 if flush:
220 bufs.append(dco.flush())
221 else:
222 while chunk:
223 chunk = dco.decompress('', max_length)
224 self.failIf(len(chunk) > max_length,
225 'chunk too big (%d>%d)' % (len(chunk),max_length))
226 bufs.append(chunk)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000227 self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved')
228
Neil Schemenauer6412b122004-06-05 19:34:28 +0000229 def test_decompressmaxlenflush(self):
230 self.test_decompressmaxlen(flush=True)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000231
232 def test_maxlenmisc(self):
233 # Misc tests of max_length
Neil Schemenauer94afd3e2004-06-05 19:02:52 +0000234 dco = zlib.decompressobj()
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000235 self.assertRaises(ValueError, dco.decompress, "", -1)
236 self.assertEqual('', dco.unconsumed_tail)
237
238 def test_flushes(self):
239 # Test flush() with the various options, using all the
240 # different levels in order to provide more variations.
241 sync_opt = ['Z_NO_FLUSH', 'Z_SYNC_FLUSH', 'Z_FULL_FLUSH']
242 sync_opt = [getattr(zlib, opt) for opt in sync_opt
243 if hasattr(zlib, opt)]
Neil Schemenauer6412b122004-06-05 19:34:28 +0000244 data = HAMLET_SCENE * 8
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000245
246 for sync in sync_opt:
247 for level in range(10):
248 obj = zlib.compressobj( level )
249 a = obj.compress( data[:3000] )
250 b = obj.flush( sync )
251 c = obj.compress( data[3000:] )
252 d = obj.flush()
253 self.assertEqual(zlib.decompress(''.join([a,b,c,d])),
254 data, ("Decompress failed: flush "
255 "mode=%i, level=%i") % (sync, level))
256 del obj
257
258 def test_odd_flush(self):
259 # Test for odd flushing bugs noted in 2.0, and hopefully fixed in 2.1
260 import random
261
262 if hasattr(zlib, 'Z_SYNC_FLUSH'):
263 # Testing on 17K of "random" data
264
265 # Create compressor and decompressor objects
Neil Schemenauer6412b122004-06-05 19:34:28 +0000266 co = zlib.compressobj(zlib.Z_BEST_COMPRESSION)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000267 dco = zlib.decompressobj()
268
269 # Try 17K of data
270 # generate random data stream
271 try:
272 # In 2.3 and later, WichmannHill is the RNG of the bug report
273 gen = random.WichmannHill()
274 except AttributeError:
275 try:
276 # 2.2 called it Random
277 gen = random.Random()
278 except AttributeError:
279 # others might simply have a single RNG
280 gen = random
281 gen.seed(1)
282 data = genblock(1, 17 * 1024, generator=gen)
283
284 # compress, sync-flush, and decompress
285 first = co.compress(data)
286 second = co.flush(zlib.Z_SYNC_FLUSH)
287 expanded = dco.decompress(first + second)
288
289 # if decompressed data is different from the input data, choke.
290 self.assertEqual(expanded, data, "17K random source doesn't match")
291
Andrew M. Kuchling3b585b32004-12-28 20:10:48 +0000292 def test_empty_flush(self):
293 # Test that calling .flush() on unused objects works.
294 # (Bug #1083110 -- calling .flush() on decompress objects
295 # caused a core dump.)
296
297 co = zlib.compressobj(zlib.Z_BEST_COMPRESSION)
298 self.failUnless(co.flush()) # Returns a zlib header
299 dco = zlib.decompressobj()
300 self.assertEqual(dco.flush(), "") # Returns nothing
Tim Peters5a9fb3c2005-01-07 16:01:32 +0000301
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000302 if hasattr(zlib.compressobj(), "copy"):
303 def test_compresscopy(self):
304 # Test copying a compression object
305 data0 = HAMLET_SCENE
306 data1 = HAMLET_SCENE.swapcase()
307 c0 = zlib.compressobj(zlib.Z_BEST_COMPRESSION)
308 bufs0 = []
309 bufs0.append(c0.compress(data0))
Georg Brandl8d3342b2006-05-16 07:38:27 +0000310
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000311 c1 = c0.copy()
312 bufs1 = bufs0[:]
Georg Brandl8d3342b2006-05-16 07:38:27 +0000313
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000314 bufs0.append(c0.compress(data0))
315 bufs0.append(c0.flush())
316 s0 = ''.join(bufs0)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000317
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000318 bufs1.append(c1.compress(data1))
319 bufs1.append(c1.flush())
320 s1 = ''.join(bufs1)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000321
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000322 self.assertEqual(zlib.decompress(s0),data0+data0)
323 self.assertEqual(zlib.decompress(s1),data0+data1)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000324
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000325 def test_badcompresscopy(self):
326 # Test copying a compression object in an inconsistent state
327 c = zlib.compressobj()
328 c.compress(HAMLET_SCENE)
329 c.flush()
330 self.assertRaises(ValueError, c.copy)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000331
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000332 if hasattr(zlib.decompressobj(), "copy"):
333 def test_decompresscopy(self):
334 # Test copying a decompression object
335 data = HAMLET_SCENE
336 comp = zlib.compress(data)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000337
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000338 d0 = zlib.decompressobj()
339 bufs0 = []
340 bufs0.append(d0.decompress(comp[:32]))
Georg Brandl8d3342b2006-05-16 07:38:27 +0000341
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000342 d1 = d0.copy()
343 bufs1 = bufs0[:]
Georg Brandl8d3342b2006-05-16 07:38:27 +0000344
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000345 bufs0.append(d0.decompress(comp[32:]))
346 s0 = ''.join(bufs0)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000347
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000348 bufs1.append(d1.decompress(comp[32:]))
349 s1 = ''.join(bufs1)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000350
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000351 self.assertEqual(s0,s1)
352 self.assertEqual(s0,data)
Georg Brandl8d3342b2006-05-16 07:38:27 +0000353
Neal Norwitz6e73aaa2006-06-12 03:33:09 +0000354 def test_baddecompresscopy(self):
355 # Test copying a compression object in an inconsistent state
356 data = zlib.compress(HAMLET_SCENE)
357 d = zlib.decompressobj()
358 d.decompress(data)
359 d.flush()
360 self.assertRaises(ValueError, d.copy)
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000361
362def genblock(seed, length, step=1024, generator=random):
363 """length-byte stream of random data from a seed (in step-byte blocks)."""
364 if seed is not None:
365 generator.seed(seed)
366 randint = generator.randint
367 if length < step or step < 2:
368 step = length
369 blocks = []
370 for i in range(0, length, step):
371 blocks.append(''.join([chr(randint(0,255))
372 for x in range(step)]))
373 return ''.join(blocks)[:length]
374
375
376
377def choose_lines(source, number, seed=None, generator=random):
378 """Return a list of number lines randomly chosen from the source"""
379 if seed is not None:
380 generator.seed(seed)
381 sources = source.split('\n')
382 return [generator.choice(sources) for n in range(number)]
383
384
385
Neil Schemenauer6412b122004-06-05 19:34:28 +0000386HAMLET_SCENE = """
Fred Drake004d5e62000-10-23 17:22:08 +0000387LAERTES
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000388
389 O, fear me not.
390 I stay too long: but here my father comes.
391
392 Enter POLONIUS
393
394 A double blessing is a double grace,
395 Occasion smiles upon a second leave.
396
Fred Drake004d5e62000-10-23 17:22:08 +0000397LORD POLONIUS
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000398
399 Yet here, Laertes! aboard, aboard, for shame!
400 The wind sits in the shoulder of your sail,
401 And you are stay'd for. There; my blessing with thee!
402 And these few precepts in thy memory
403 See thou character. Give thy thoughts no tongue,
404 Nor any unproportioned thought his act.
405 Be thou familiar, but by no means vulgar.
406 Those friends thou hast, and their adoption tried,
407 Grapple them to thy soul with hoops of steel;
408 But do not dull thy palm with entertainment
409 Of each new-hatch'd, unfledged comrade. Beware
410 Of entrance to a quarrel, but being in,
411 Bear't that the opposed may beware of thee.
412 Give every man thy ear, but few thy voice;
413 Take each man's censure, but reserve thy judgment.
414 Costly thy habit as thy purse can buy,
415 But not express'd in fancy; rich, not gaudy;
416 For the apparel oft proclaims the man,
417 And they in France of the best rank and station
418 Are of a most select and generous chief in that.
419 Neither a borrower nor a lender be;
420 For loan oft loses both itself and friend,
421 And borrowing dulls the edge of husbandry.
422 This above all: to thine ownself be true,
423 And it must follow, as the night the day,
424 Thou canst not then be false to any man.
425 Farewell: my blessing season this in thee!
426
Fred Drake004d5e62000-10-23 17:22:08 +0000427LAERTES
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000428
429 Most humbly do I take my leave, my lord.
430
Fred Drake004d5e62000-10-23 17:22:08 +0000431LORD POLONIUS
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000432
433 The time invites you; go; your servants tend.
434
Fred Drake004d5e62000-10-23 17:22:08 +0000435LAERTES
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000436
437 Farewell, Ophelia; and remember well
438 What I have said to you.
439
Fred Drake004d5e62000-10-23 17:22:08 +0000440OPHELIA
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000441
442 'Tis in my memory lock'd,
443 And you yourself shall keep the key of it.
444
Fred Drake004d5e62000-10-23 17:22:08 +0000445LAERTES
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +0000446
447 Farewell.
448"""
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000449
450
451def test_main():
Walter Dörwald21d3a322003-05-01 17:45:56 +0000452 test_support.run_unittest(
453 ChecksumTestCase,
454 ExceptionTestCase,
455 CompressTestCase,
456 CompressObjectTestCase
457 )
Guido van Rossum7d9ea502003-02-03 20:45:52 +0000458
459if __name__ == "__main__":
460 test_main()