[pypy-svn] r58966 - pypy/branch/2.5-merge/lib-python/modified-2.5.2/test
arigo at codespeak.net
arigo at codespeak.net
Sat Oct 11 13:44:03 CEST 2008
Author: arigo
Date: Sat Oct 11 13:44:03 2008
New Revision: 58966
Modified:
pypy/branch/2.5-merge/lib-python/modified-2.5.2/test/test_marshal.py
Log:
(antocuni, arigo)
Cancel some changes in test_marshal that look suspicious.
The only change left is to call close() on all files.
Modified: pypy/branch/2.5-merge/lib-python/modified-2.5.2/test/test_marshal.py
==============================================================================
--- pypy/branch/2.5-merge/lib-python/modified-2.5.2/test/test_marshal.py (original)
+++ pypy/branch/2.5-merge/lib-python/modified-2.5.2/test/test_marshal.py Sat Oct 11 13:44:03 2008
@@ -7,9 +7,9 @@
import unittest
import os
-def dump_and_load(obj):
+def dump_and_load(obj, *extra_args):
f = file(test_support.TESTFN, "wb")
- marshal.dump(obj, f)
+ marshal.dump(obj, f, *extra_args)
f.close()
f = file(test_support.TESTFN, "rb")
got = marshal.load(f)
@@ -79,7 +79,7 @@
n /= 123.4567
f = 0.0
- s = marshal.dumps(f)
+ s = marshal.dumps(f, 2)
got = marshal.loads(s)
self.assertEqual(f, got)
# and with version <= 1 (floats marshalled differently then)
@@ -91,11 +91,20 @@
while n < small:
for expected in (-n, n):
f = float(expected)
+
s = marshal.dumps(f)
got = marshal.loads(s)
self.assertEqual(f, got)
+
+ s = marshal.dumps(f, 1)
+ got = marshal.loads(s)
+ self.assertEqual(f, got)
+
got = dump_and_load(f)
self.assertEqual(f, got)
+
+ got = dump_and_load(f, 1)
+ self.assertEqual(f, got)
n *= 123.4567
os.unlink(test_support.TESTFN)
More information about the Pypy-commit
mailing list