diff options
author | Stephan Hoyer <shoyer@google.com> | 2019-05-13 08:09:26 -0700 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2019-05-13 08:09:26 -0700 |
commit | 07452c86c78a1cf213a764d17f060b4887ec3681 (patch) | |
tree | 12c7ae7b14552bd28334277e7e244b603ca4300a /numpy/lib/tests/test_recfunctions.py | |
parent | 804f71bb42fef775a85a52366dc4bd1a22c130a8 (diff) | |
parent | 4ad33d21b1a30f931e23307e9f9355b70f633bed (diff) | |
download | numpy-07452c86c78a1cf213a764d17f060b4887ec3681.tar.gz |
Merge branch 'master' into implement-numpy-implementation
Diffstat (limited to 'numpy/lib/tests/test_recfunctions.py')
-rw-r--r-- | numpy/lib/tests/test_recfunctions.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py index 069693613..f713fb64d 100644 --- a/numpy/lib/tests/test_recfunctions.py +++ b/numpy/lib/tests/test_recfunctions.py @@ -214,6 +214,8 @@ class TestRecFunctions(object): dtype=[('x', 'i4'), ('y', 'f4'), ('z', 'f8')]) out = np.mean(structured_to_unstructured(b[['x', 'z']]), axis=-1) assert_equal(out, np.array([ 3. , 5.5, 9. , 11. ])) + out = np.mean(structured_to_unstructured(b[['x']]), axis=-1) + assert_equal(out, np.array([ 1. , 4. , 7. , 10. ])) c = np.arange(20).reshape((4,5)) out = unstructured_to_structured(c, a.dtype) @@ -241,6 +243,15 @@ class TestRecFunctions(object): assert_(dd.base is d) assert_(ddd.base is d) + # including uniform fields with subarrays unpacked + d = np.array([(1, [2, 3], [[ 4, 5], [ 6, 7]]), + (8, [9, 10], [[11, 12], [13, 14]])], + dtype=[('x0', 'i4'), ('x1', ('i4', 2)), ('x2', ('i4', (2, 2)))]) + dd = structured_to_unstructured(d) + ddd = unstructured_to_structured(dd, d.dtype) + assert_(dd.base is d) + assert_(ddd.base is d) + # test that nested fields with identical names don't break anything point = np.dtype([('x', int), ('y', int)]) triangle = np.dtype([('a', point), ('b', point), ('c', point)]) |