diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-07-01 15:20:01 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-07-01 15:28:56 +0100 |
commit | 57225485fe72ca059e8c7d9fa17a07c3a31ba009 (patch) | |
tree | 388f8b3be54051dde5f5dca68050910ae501797a /numpy/lib/tests/test_recfunctions.py | |
parent | bdbac02b0bddb265840cc00cc5dec0590c09b093 (diff) | |
download | numpy-57225485fe72ca059e8c7d9fa17a07c3a31ba009.tar.gz |
BUG: stack_arrays fails for subdtypes
Again, fixed by not using descr
Diffstat (limited to 'numpy/lib/tests/test_recfunctions.py')
-rw-r--r-- | numpy/lib/tests/test_recfunctions.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py index 50a85a08e..799d7cd8e 100644 --- a/numpy/lib/tests/test_recfunctions.py +++ b/numpy/lib/tests/test_recfunctions.py @@ -546,6 +546,35 @@ class TestStackArrays(TestCase): assert_equal(test, control) assert_equal(test.mask, control.mask) + def test_subdtype(self): + z = np.array([ + ('A', 1), ('B', 2) + ], dtype=[('A', '|S3'), ('B', float, (1,))]) + zz = np.array([ + ('a', [10.], 100.), ('b', [20.], 200.), ('c', [30.], 300.) + ], dtype=[('A', '|S3'), ('B', float, (1,)), ('C', float)]) + + res = stack_arrays((z, zz)) + expected = ma.array( + data=[ + (b'A', [1.0], 0), + (b'B', [2.0], 0), + (b'a', [10.0], 100.0), + (b'b', [20.0], 200.0), + (b'c', [30.0], 300.0)], + mask=[ + (False, [False], True), + (False, [False], True), + (False, [False], False), + (False, [False], False), + (False, [False], False) + ], + dtype=zz.dtype + ) + assert_equal(res.dtype, expected.dtype) + assert_equal(res, expected) + assert_equal(res.mask, expected.mask) + class TestJoinBy(TestCase): def setUp(self): |