Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tests/suite/modules/io_related/test_marshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ def test_file_multiple_reads(self):
l.append(marshal.dumps({i:i}))

data = b''.join(l)
with open('tempfile.txt', 'wb') as f:
tmpfile = os.path.join(self.temporary_dir, 'tempfile_%d.txt' % os.getpid())
with open(tmpfile, 'wb') as f:
f.write(data)

with open('tempfile.txt', 'rb') as f:
with open(tmpfile, 'rb') as f:
for i in range(10):
obj = marshal.load(f)
self.assertEqual(obj, {i:i})

self.delete_files('tempfile.txt')
self.delete_files(tmpfile)

def test_string_interning(self):
self.assertEqual(marshal.dumps(['abc', 'abc'], 0), b'[\x02\x00\x00\x00u\x03\x00\x00\x00abcu\x03\x00\x00\x00abc')
Expand Down
11 changes: 6 additions & 5 deletions tests/suite/modules/misc/test_zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

from iptest import IronPythonTestCase, run_test

def create_gzip(text):
def create_gzip(text, path):
import gzip
with gzip.open('test_data.gz', 'wb') as f:
with gzip.open(path, 'wb') as f:
f.write(text)
with open('test_data.gz', 'rb') as f:
with open(path, 'rb') as f:
gzip_compress = f.read()
return gzip_compress

Expand Down Expand Up @@ -48,11 +48,12 @@ def setUp(self):
zlib_compress = zlib.compressobj(9, zlib.DEFLATED, zlib.MAX_WBITS)
self.deflate_data = deflate_compress.compress(self.text) + deflate_compress.flush()
self.zlib_data = zlib_compress.compress(self.text) + zlib_compress.flush()
self.gzip_data = create_gzip(self.text)
self.gzip_file = os.path.join(self.temporary_dir, "test_data_%d.gz" % os.getpid())
self.gzip_data = create_gzip(self.text, self.gzip_file)

def tearDown(self):
super(ZlibTest, self).tearDown()
os.remove("test_data.gz")
os.remove(self.gzip_file)

def test_gzip(self):
"""decompression with gzip header"""
Expand Down
Loading