[pypy-commit] pypy numpy-pickle: Add a test for pickling scalars

rguillebert noreply at buildbot.pypy.org
Fri May 24 16:53:14 CEST 2013


Author: Romain Guillebert <romain.py at gmail.com>
Branch: numpy-pickle
Changeset: r64537:ccb9a74db059
Date: 2013-05-24 16:42 +0200
http://bitbucket.org/pypy/pypy/changeset/ccb9a74db059/

Log:	Add a test for pickling scalars

diff --git a/pypy/module/micronumpy/test/test_scalar.py b/pypy/module/micronumpy/test/test_scalar.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/micronumpy/test/test_scalar.py
@@ -0,0 +1,11 @@
+from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
+
+class AppTestScalar(BaseNumpyAppTest):
+    spaceconfig = dict(usemodules=["micronumpy", "binascii", "struct"])
+
+    def test_pickle(self):
+        from numpypy import dtype, int32, float64, complex128
+        from numpypy.core.multiarray import scalar
+        assert int32(1337).__reduce__() == (scalar, (dtype('int32'), '9\x05\x00\x00'))
+        assert float64(13.37).__reduce__() == (scalar, (dtype('float64'), '=\n\xd7\xa3p\xbd*@'))
+        assert complex128(13 + 37.j).__reduce__() == (scalar, (dtype('complex128'), '\x00\x00\x00\x00\x00\x00*@\x00\x00\x00\x00\x00\x80B@'))


More information about the pypy-commit mailing list