summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
authormwtoews <mwtoews@gmail.com>2013-07-09 22:45:46 +1200
committermwtoews <mwtoews@gmail.com>2013-07-09 22:45:46 +1200
commit64d5832d0b675436a52e10a06d5386611c8eb889 (patch)
treefc4fbc7f66f8628bdba47b669969b102ce22619b /numpy/core
parent884c403605d5679d4e224bb24263a490f1249b6f (diff)
downloadnumpy-64d5832d0b675436a52e10a06d5386611c8eb889.tar.gz
Add regression tests for pickleable record arrays
Diffstat (limited to 'numpy/core')
-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]