summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2018-11-22 19:47:58 -0500
committerAllan Haldane <allan.haldane@gmail.com>2018-11-26 14:55:37 -0500
commit845def00c85f9f40cfa64e6dabb4158bebd502f4 (patch)
treeaef5ff6b10c269dbc87bd09fe912c1b76f1e5304 /numpy/lib/tests
parentb47ed76ebfbbd91b5d475eb19043a98e95dc2ad5 (diff)
downloadnumpy-845def00c85f9f40cfa64e6dabb4158bebd502f4.tar.gz
ENH: add back the multifield copy->view change
Fixes #10409 Closes #11530
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_io.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index b746937b9..f2d5d4ab5 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -355,6 +355,16 @@ class TestSaveTxt(object):
c.seek(0)
assert_equal(c.readlines(), [b'1 2\n', b'3 4\n'])
+ @pytest.mark.skipif(Path is None, reason="No pathlib.Path")
+ def test_multifield_view(self):
+ a = np.ones(1, dtype=[('x', 'i4'), ('y', 'i4'), ('z', 'f4')])
+ v = a[['x', 'z']]
+ with temppath(suffix='.npy') as path:
+ path = Path(path)
+ np.save(path, v)
+ data = np.load(path)
+ assert_array_equal(data, v)
+
def test_delimiter(self):
a = np.array([[1., 2.], [3., 4.]])
c = BytesIO()