From b5895be146cdc3063ffa9ca8ae27b5bcf7992719 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sun, 14 Apr 2019 19:26:53 -0700 Subject: BUG: Fix structured_to_unstructured on single-field types Previously a single-field type would decay, which is undesirable. The included test previously did not pass --- numpy/lib/tests/test_recfunctions.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'numpy/lib/tests/test_recfunctions.py') diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py index 11f8a5afa..d1fcf2153 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) -- cgit v1.2.1