[pypy-svn] pypy default: Fix marshal tests.
alex_gaynor
commits-noreply at bitbucket.org
Wed Jan 19 17:26:45 CET 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch:
Changeset: r40936:d15a93b567af
Date: 2011-01-19 10:03 -0600
http://bitbucket.org/pypy/pypy/changeset/d15a93b567af/
Log: Fix marshal tests.
diff --git a/pypy/module/marshal/test/test_marshal.py b/pypy/module/marshal/test/test_marshal.py
--- a/pypy/module/marshal/test/test_marshal.py
+++ b/pypy/module/marshal/test/test_marshal.py
@@ -1,27 +1,22 @@
from pypy.tool.udir import udir
-def make_check(space):
- return space.appexec([], """():
- import marshal, StringIO
- def marshal_check(case):
- s = marshal.dumps(case)
- print repr(s)
- x = marshal.loads(s)
- assert x == case and type(x) is type(case)
- f = StringIO.StringIO()
- marshal.dump(case, f)
- f.seek(0)
- x = marshal.load(f)
- assert x == case and type(x) is type(case)
- return marshal_check
- """)
class AppTestMarshal:
-
def setup_class(cls):
tmpfile = udir.join('AppTestMarshal.tmp')
cls.w_tmpfile = cls.space.wrap(str(tmpfile))
- cls.w_marshal_check = make_check(cls.space)
+
+ def w_marshal_check(self, case):
+ import marshal, StringIO
+ s = marshal.dumps(case)
+ print repr(s)
+ x = marshal.loads(s)
+ assert x == case and type(x) is type(case)
+ f = StringIO.StringIO()
+ marshal.dump(case, f)
+ f.seek(0)
+ x = marshal.load(f)
+ assert x == case and type(x) is type(case)
def test_None(self):
case = None
More information about the Pypy-commit
mailing list