summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_recfunctions.py
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2018-06-10 21:54:21 -0400
committerAllan Haldane <allan.haldane@gmail.com>2018-06-11 11:51:04 -0400
commite08eced7990fbdcecb2bd81d3fc736f69bad6dfd (patch)
tree9ded5059b440cff8c4f52519692e4c456c66717d /numpy/lib/tests/test_recfunctions.py
parent8525d3e30f3b57332dfd374bc64b068366126b52 (diff)
downloadnumpy-e08eced7990fbdcecb2bd81d3fc736f69bad6dfd.tar.gz
MAINT: push back multifield copy->view changes to 1.16
Diffstat (limited to 'numpy/lib/tests/test_recfunctions.py')
-rw-r--r--numpy/lib/tests/test_recfunctions.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py
index 219ae24fa..d4828bc1f 100644
--- a/numpy/lib/tests/test_recfunctions.py
+++ b/numpy/lib/tests/test_recfunctions.py
@@ -9,8 +9,8 @@ from numpy.ma.testutils import assert_equal
from numpy.testing import assert_, assert_raises
from numpy.lib.recfunctions import (
drop_fields, rename_fields, get_fieldstructure, recursive_fill_fields,
- find_duplicates, merge_arrays, append_fields, stack_arrays, join_by
- )
+ find_duplicates, merge_arrays, append_fields, stack_arrays, join_by,
+ repack_fields)
get_names = np.lib.recfunctions.get_names
get_names_flat = np.lib.recfunctions.get_names_flat
zip_descr = np.lib.recfunctions.zip_descr
@@ -192,6 +192,18 @@ class TestRecFunctions(object):
assert_equal(sorted(test[-1]), control)
assert_equal(test[0], a[test[-1]])
+ def test_repack_fields(self):
+ dt = np.dtype('u1,f4,i8', align=True)
+ a = np.zeros(2, dtype=dt)
+
+ assert_equal(repack_fields(dt), np.dtype('u1,f4,i8'))
+ assert_equal(repack_fields(a).itemsize, 13)
+ assert_equal(repack_fields(repack_fields(dt), align=True), dt)
+
+ # make sure type is preserved
+ dt = np.dtype((np.record, dt))
+ assert_(repack_fields(dt).type is np.record)
+
class TestRecursiveFillFields(object):
# Test recursive_fill_fields.