1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-26 16:45:12 -04: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 Kalle Olavi Niemitalo
parent 99c144381a
commit 8e0938d2fc
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:]