summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_recfunctions.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-04-14 19:26:53 -0700
committerEric Wieser <wieser.eric@gmail.com>2019-04-15 22:26:19 -0700
commitb5895be146cdc3063ffa9ca8ae27b5bcf7992719 (patch)
tree527d2ed54be1fa1f068d740aba555c845761bb9a /numpy/lib/tests/test_recfunctions.py
parent191d5c78383771e9a4825801062d0f23625410bf (diff)
downloadnumpy-b5895be146cdc3063ffa9ca8ae27b5bcf7992719.tar.gz
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
Diffstat (limited to 'numpy/lib/tests/test_recfunctions.py')
-rw-r--r--numpy/lib/tests/test_recfunctions.py2
1 files changed, 2 insertions, 0 deletions
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)