diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-07-22 15:02:53 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-07-22 18:47:31 +0100 |
commit | c9ffde629b0f10255714b84fe75681c7f9fc4251 (patch) | |
tree | 4711620edb4db433db999be86b7768991a79ac5e /numpy/core/tests | |
parent | 486a764c08c24ccba0d4baad901378112a9eec88 (diff) | |
download | numpy-c9ffde629b0f10255714b84fe75681c7f9fc4251.tar.gz |
BUG: Make np.array([[1], 2]) and np.array([1, [2]]) behave in the same way
Diffstat (limited to 'numpy/core/tests')
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index e85a73154..07d1361d6 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -903,6 +903,19 @@ class TestCreation(object): assert_raises(ValueError, np.ndarray, buffer=buf, strides=(0,), shape=(max_bytes//itemsize + 1,), dtype=dtype) + def test_jagged_ndim_object(self): + # Lists of mismatching depths are treated as object arrays + a = np.array([[1], 2, 3]) + assert_equal(a.shape, (3,)) + assert_equal(a.dtype, object) + + a = np.array([1, [2], 3]) + assert_equal(a.shape, (3,)) + assert_equal(a.dtype, object) + + a = np.array([1, 2, [3]]) + assert_equal(a.shape, (3,)) + assert_equal(a.dtype, object) class TestStructured(object): def test_subarray_field_access(self): |