summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_recfunctions.py
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2018-10-31 17:23:27 -0400
committerAllan Haldane <allan.haldane@gmail.com>2018-11-22 18:15:51 -0500
commitc89273320a964e303121b4f42f08130e1e609499 (patch)
tree4132754c51c67aa4d3d47e658e9701431c277bb4 /numpy/lib/tests/test_recfunctions.py
parentf1fba70edd1829c64e3290fa6b1a20d01e9d9674 (diff)
downloadnumpy-c89273320a964e303121b4f42f08130e1e609499.tar.gz
ENH: Fixups to multi-field assignment helpers
Diffstat (limited to 'numpy/lib/tests/test_recfunctions.py')
-rw-r--r--numpy/lib/tests/test_recfunctions.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py
index 8b61ba0bf..7ec33d92a 100644
--- a/numpy/lib/tests/test_recfunctions.py
+++ b/numpy/lib/tests/test_recfunctions.py
@@ -233,6 +233,14 @@ class TestRecFunctions(object):
assert_equal(apply_along_fields(np.mean, d[['x', 'z']]),
np.array([ 3. , 5.5, 9. , 11. ]))
+ # check that for uniform field dtypes we get a view, not a copy:
+ d = np.array([(1, 2, 5), (4, 5, 7), (7, 8 ,11), (10, 11, 12)],
+ dtype=[('x', 'i4'), ('y', 'i4'), ('z', 'i4')])
+ dd = structured_to_unstructured(d)
+ ddd = unstructured_to_structured(dd, d.dtype)
+ assert_(dd.base is d)
+ assert_(ddd.base is d)
+
def test_field_assignment_by_name(self):
a = np.ones(2, dtype=[('a', 'i4'), ('b', 'f8'), ('c', 'u1')])
newdt = [('b', 'f4'), ('c', 'u1')]