blob: 79eb8772a74de6294c074a93461b97447711094e [file] [log] [blame]
Jeremy Hylton6eb4b6a1997-08-15 15:59:43 +00001import zlib
2import sys
3
4buf = open(sys.argv[0]).read() * 8
5
6x = zlib.compress(buf)
7y = zlib.decompress(x)
8if buf != y:
9 print "normal compression/decompression failed"
10
11buf = buf * 16
12
13co = zlib.compressobj(8, 8, -15)
14x1 = co.compress(buf)
15x2 = co.flush()
16x = x1 + x2
17
18dc = zlib.decompressobj(-15)
19y1 = dc.decompress(x)
20y2 = dc.flush()
21y = y1 + y2
22if buf != y:
23 print "compress/decompression obj failed"
24
25def ignore():
26 """An empty function with a big string.
27
28 Make the compression algorithm work a little harder.
29 """
30
31 """
32LAERTES
33
34 O, fear me not.
35 I stay too long: but here my father comes.
36
37 Enter POLONIUS
38
39 A double blessing is a double grace,
40 Occasion smiles upon a second leave.
41
42LORD POLONIUS
43
44 Yet here, Laertes! aboard, aboard, for shame!
45 The wind sits in the shoulder of your sail,
46 And you are stay'd for. There; my blessing with thee!
47 And these few precepts in thy memory
48 See thou character. Give thy thoughts no tongue,
49 Nor any unproportioned thought his act.
50 Be thou familiar, but by no means vulgar.
51 Those friends thou hast, and their adoption tried,
52 Grapple them to thy soul with hoops of steel;
53 But do not dull thy palm with entertainment
54 Of each new-hatch'd, unfledged comrade. Beware
55 Of entrance to a quarrel, but being in,
56 Bear't that the opposed may beware of thee.
57 Give every man thy ear, but few thy voice;
58 Take each man's censure, but reserve thy judgment.
59 Costly thy habit as thy purse can buy,
60 But not express'd in fancy; rich, not gaudy;
61 For the apparel oft proclaims the man,
62 And they in France of the best rank and station
63 Are of a most select and generous chief in that.
64 Neither a borrower nor a lender be;
65 For loan oft loses both itself and friend,
66 And borrowing dulls the edge of husbandry.
67 This above all: to thine ownself be true,
68 And it must follow, as the night the day,
69 Thou canst not then be false to any man.
70 Farewell: my blessing season this in thee!
71
72LAERTES
73
74 Most humbly do I take my leave, my lord.
75
76LORD POLONIUS
77
78 The time invites you; go; your servants tend.
79
80LAERTES
81
82 Farewell, Ophelia; and remember well
83 What I have said to you.
84
85OPHELIA
86
87 'Tis in my memory lock'd,
88 And you yourself shall keep the key of it.
89
90LAERTES
91
92 Farewell.
93"""
94