mirror of
https://github.com/rkd77/elinks.git
synced 2025-04-18 00:47:36 -04:00
Encoding tests rewritten. They do not create files in /tmp.
This commit is contained in:
parent
55f96ecc3f
commit
d61519666e
@ -2,16 +2,7 @@
|
|||||||
import bz2, os, time
|
import bz2, os, time
|
||||||
|
|
||||||
data1 = '<html><body>Two lines should be visible.<br/>The second line.</body></html>'
|
data1 = '<html><body>Two lines should be visible.<br/>The second line.</body></html>'
|
||||||
|
cd1 = bz2.compress(data1)
|
||||||
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")
|
|
||||||
|
|
||||||
length = len(cd1)
|
length = len(cd1)
|
||||||
next_chunk = hex(length - 10)[2:]
|
next_chunk = hex(length - 10)[2:]
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/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>'
|
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.write(data1)
|
||||||
f1.close()
|
f1.close()
|
||||||
|
|
||||||
f = open("/tmp/1.gz")
|
cd1 = output.getvalue()
|
||||||
cd1 = f.read()
|
output.close()
|
||||||
f.close()
|
|
||||||
|
|
||||||
os.unlink("/tmp/1.gz")
|
|
||||||
|
|
||||||
length = len(cd1)
|
length = len(cd1)
|
||||||
next_chunk = hex(length - 10)[2:]
|
next_chunk = hex(length - 10)[2:]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user