[pypy-commit] pypy py3k: (antocuni, rguillebert) Add a marshalling test of pycode objects

rguillebert noreply at buildbot.pypy.org
Thu Jan 19 17:17:22 CET 2012


Author: Romain Guillebert <romain.py at gmail.com>
Branch: py3k
Changeset: r51488:176a25c48305
Date: 2012-01-19 17:17 +0100
http://bitbucket.org/pypy/pypy/changeset/176a25c48305/

Log:	(antocuni, rguillebert) Add a marshalling test of pycode objects

diff --git a/pypy/module/marshal/test/test_marshalimpl.py b/pypy/module/marshal/test/test_marshalimpl.py
--- a/pypy/module/marshal/test/test_marshalimpl.py
+++ b/pypy/module/marshal/test/test_marshalimpl.py
@@ -55,6 +55,17 @@
         z = marshal.loads('I\x00\x1c\xf4\xab\xfd\xff\xff\xff')
         assert z == -10000000000
 
+    def test_marshal_code_object(self):
+        def foo(a, b):
+            pass
+
+        import marshal
+        s = marshal.dumps(foo.__code__)
+        code2 = marshal.loads(s)
+        for attr_name in dir(code2):
+            if attr_name.startswith("co_"):
+                assert getattr(code2, attr_name) == getattr(foo.__code__, attr_name)
+
 
 class AppTestMarshalSmallLong(AppTestMarshalMore):
     def setup_class(cls):


More information about the pypy-commit mailing list