diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-02-13 21:17:23 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-02-13 22:50:24 +0000 |
commit | d9b26f804117ebc1f591dff33d06ce2339af9339 (patch) | |
tree | ff17a3b1c6872819d7fb90786fccaf137c583fec /numpy/lib | |
parent | d932fcd38d9ef0f76c988d6c197856fa0c71314b (diff) | |
download | numpy-d9b26f804117ebc1f591dff33d06ce2339af9339.tar.gz |
BUG: The broadcast shape of no things should be (), not ValueError
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/stride_tricks.py | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_stride_tricks.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/stride_tricks.py b/numpy/lib/stride_tricks.py index f390cf49b..545623c38 100644 --- a/numpy/lib/stride_tricks.py +++ b/numpy/lib/stride_tricks.py @@ -179,7 +179,7 @@ def _broadcast_shape(*args): supplied arrays against each other. """ if not args: - raise ValueError('must provide at least one argument') + return () # use the old-iterator because np.nditer does not handle size 0 arrays # consistently b = np.broadcast(*args[:32]) diff --git a/numpy/lib/tests/test_stride_tricks.py b/numpy/lib/tests/test_stride_tricks.py index 95df135cf..39a76c2f6 100644 --- a/numpy/lib/tests/test_stride_tricks.py +++ b/numpy/lib/tests/test_stride_tricks.py @@ -266,7 +266,7 @@ def test_broadcast_to_raises(): def test_broadcast_shape(): # broadcast_shape is already exercized indirectly by broadcast_arrays - assert_raises(ValueError, _broadcast_shape) + assert_equal(_broadcast_shape(), ()) assert_equal(_broadcast_shape([1, 2]), (2,)) assert_equal(_broadcast_shape(np.ones((1, 1))), (1, 1)) assert_equal(_broadcast_shape(np.ones((1, 1)), np.ones((3, 4))), (3, 4)) |