diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2019-05-11 10:08:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-11 10:08:10 -0700 |
commit | 3337865dd9f1c6141199577a8a7a432551a04f9e (patch) | |
tree | ff5f09943484eb6e538964139260d51632592590 /numpy/lib/tests/test_recfunctions.py | |
parent | 4a2b6a7d8e389abe06d5d7f2fbfa6ebd03b9092a (diff) | |
parent | e6a7e05753f8a5f56de9653bfecd85a22f53d7c6 (diff) | |
download | numpy-3337865dd9f1c6141199577a8a7a432551a04f9e.tar.gz |
Merge pull request #13332 from eric-wieser/fix-subarray-unstructured
BUG: Always return views from structured_to_unstructured when possible
Diffstat (limited to 'numpy/lib/tests/test_recfunctions.py')
-rw-r--r-- | numpy/lib/tests/test_recfunctions.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py index 112678294..f713fb64d 100644 --- a/numpy/lib/tests/test_recfunctions.py +++ b/numpy/lib/tests/test_recfunctions.py @@ -243,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)]) |