1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Encoding tests rewritten. They do not create files in /tmp.

This commit is contained in:
Witold Filipczyk 2008-02-14 10:39:56 +01:00 committed by Witold Filipczyk
parent 55f96ecc3f
commit d61519666e
2 changed files with 7 additions and 17 deletions

View File

@ -2,16 +2,7 @@
import bz2, os, time
data1 = '<html><body>Two lines should be visible.<br/>The second line.</body></html>'
f1 = bz2.BZ2File("/tmp/1.bz2", mode = "wb")
f1.write(data1)
f1.close()
f = open("/tmp/1.bz2")
cd1 = f.read()
f.close()
os.unlink("/tmp/1.bz2")
cd1 = bz2.compress(data1)
length = len(cd1)
next_chunk = hex(length - 10)[2:]

View File

@ -1,17 +1,16 @@
#!/usr/bin/env python
import gzip, os, time
import gzip, os, time, StringIO
output = StringIO.StringIO()
data1 = '<html><body>Two lines should be visible.<br/>The second line.</body></html>'
f1 = gzip.GzipFile("/tmp/1.gz", mode = "wb")
f1 = gzip.GzipFile("/tmp/1.gz", mode = "wb", fileobj=output)
f1.write(data1)
f1.close()
f = open("/tmp/1.gz")
cd1 = f.read()
f.close()
os.unlink("/tmp/1.gz")
cd1 = output.getvalue()
output.close()
length = len(cd1)
next_chunk = hex(length - 10)[2:]