diff options
author | Pierre Glaser <pierreglaser@msn.com> | 2018-10-05 13:26:59 +0200 |
---|---|---|
committer | Pierre Glaser <pierreglaser@msn.com> | 2018-10-05 14:12:18 +0200 |
commit | 6655793d735ce6ced5075dcb898737c9756c7937 (patch) | |
tree | 7a46870b8cf0f7f7d0aabda72cd48e9e23f3d4e8 /numpy/matrixlib | |
parent | 592b22802df74ef7a58d2aaf6f44f45be7e2a9f8 (diff) | |
download | numpy-6655793d735ce6ced5075dcb898737c9756c7937.tar.gz |
loop over protocol for pickle tests
Diffstat (limited to 'numpy/matrixlib')
-rw-r--r-- | numpy/matrixlib/tests/test_masked_matrix.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/matrixlib/tests/test_masked_matrix.py b/numpy/matrixlib/tests/test_masked_matrix.py index 5ed8044aa..219349f93 100644 --- a/numpy/matrixlib/tests/test_masked_matrix.py +++ b/numpy/matrixlib/tests/test_masked_matrix.py @@ -79,10 +79,11 @@ class TestMaskedMatrix(object): def test_pickling_subbaseclass(self): # Test pickling w/ a subclass of ndarray a = masked_array(np.matrix(list(range(10))), mask=[1, 0, 1, 0, 0] * 2) - a_pickled = pickle.loads(a.dumps()) - assert_equal(a_pickled._mask, a._mask) - assert_equal(a_pickled, a) - assert_(isinstance(a_pickled._data, np.matrix)) + for proto in range(2, pickle.HIGHEST_PROTOCOL + 1): + a_pickled = pickle.loads(a.dumps(protocol=proto)) + assert_equal(a_pickled._mask, a._mask) + assert_equal(a_pickled, a) + assert_(isinstance(a_pickled._data, np.matrix)) def test_count_mean_with_matrix(self): m = masked_array(np.matrix([[1, 2], [3, 4]]), mask=np.zeros((2, 2))) |