Jeremy Hylton | 6eb4b6a | 1997-08-15 15:59:43 +0000 | [diff] [blame] | 1 | import zlib |
| 2 | import sys |
| 3 | |
| 4 | buf = open(sys.argv[0]).read() * 8 |
| 5 | |
| 6 | x = zlib.compress(buf) |
| 7 | y = zlib.decompress(x) |
| 8 | if buf != y: |
| 9 | print "normal compression/decompression failed" |
| 10 | |
| 11 | buf = buf * 16 |
| 12 | |
| 13 | co = zlib.compressobj(8, 8, -15) |
| 14 | x1 = co.compress(buf) |
| 15 | x2 = co.flush() |
| 16 | x = x1 + x2 |
| 17 | |
| 18 | dc = zlib.decompressobj(-15) |
| 19 | y1 = dc.decompress(x) |
| 20 | y2 = dc.flush() |
| 21 | y = y1 + y2 |
| 22 | if buf != y: |
| 23 | print "compress/decompression obj failed" |
| 24 | |
| 25 | def ignore(): |
| 26 | """An empty function with a big string. |
| 27 | |
| 28 | Make the compression algorithm work a little harder. |
| 29 | """ |
| 30 | |
| 31 | """ |
| 32 | LAERTES |
| 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 | |
| 42 | LORD 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 | |
| 72 | LAERTES |
| 73 | |
| 74 | Most humbly do I take my leave, my lord. |
| 75 | |
| 76 | LORD POLONIUS |
| 77 | |
| 78 | The time invites you; go; your servants tend. |
| 79 | |
| 80 | LAERTES |
| 81 | |
| 82 | Farewell, Ophelia; and remember well |
| 83 | What I have said to you. |
| 84 | |
| 85 | OPHELIA |
| 86 | |
| 87 | 'Tis in my memory lock'd, |
| 88 | And you yourself shall keep the key of it. |
| 89 | |
| 90 | LAERTES |
| 91 | |
| 92 | Farewell. |
| 93 | """ |
| 94 | |