summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-07-09 06:51:44 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-07-09 06:51:44 -0700
commit49a587cd786242b05fcfd22d5cda961d733b68d4 (patch)
tree9bca0db0d5f73444d0c5cf7e51ffaffa349ce480 /numpy
parent6eeb6122cc7126500e0ea7d19cea2e7dc8904e9d (diff)
parent64d5832d0b675436a52e10a06d5386611c8eb889 (diff)
downloadnumpy-49a587cd786242b05fcfd22d5cda961d733b68d4.tar.gz
Merge pull request #3510 from mwtoews/master
Add regression tests for pickleable record arrays
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_records.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/numpy/core/tests/test_records.py b/numpy/core/tests/test_records.py
index 753dec13e..8c9ce5c70 100644
--- a/numpy/core/tests/test_records.py
+++ b/numpy/core/tests/test_records.py
@@ -7,6 +7,7 @@ from numpy.compat import asbytes, asunicode
import warnings
import collections
+import pickle
class TestFromrecords(TestCase):
@@ -146,6 +147,17 @@ class TestRecord(TestCase):
y = self.data[['col2', 'col1']]
assert_equal(x[0][0], y[0][1])
+ def test_pickle_1(self):
+ # Issue #1529
+ a = np.array([(1, [])], dtype=[('a', np.int32), ('b', np.int32, 0)])
+ assert_equal(a, pickle.loads(pickle.dumps(a)))
+ assert_equal(a[0], pickle.loads(pickle.dumps(a[0])))
+
+ def test_pickle_2(self):
+ a = self.data
+ assert_equal(a, pickle.loads(pickle.dumps(a)))
+ assert_equal(a[0], pickle.loads(pickle.dumps(a[0])))
+
def test_find_duplicate():
l1 = [1, 2, 3, 4, 5, 6]