diff options
author | Skipper Seabold <jsseabold@gmail.com> | 2011-06-02 12:44:44 -0400 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2012-03-04 13:25:55 -0700 |
commit | 40f0844846a9d7665616b142407a3d74cb65a040 (patch) | |
tree | de3c25ba0dffeac73120e7b0fb07534382e2c03e /numpy/lib/tests/test_function_base.py | |
parent | 0b400cbe4bc80139d0fe88a327d4f7c3b75ecc0f (diff) | |
download | numpy-40f0844846a9d7665616b142407a3d74cb65a040.tar.gz |
ENH: Allow bincount to accept empty arrays.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index a7d501c52..145c83b77 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1131,6 +1131,17 @@ class TestBincount(TestCase): y = np.bincount(x, w, 8) assert_array_equal(y, np.array([0, 0.2, 0.5, 0, 0.5, 0.1, 0, 0])) + def test_empty(self): + x = np.array([], dtype=int) + y = np.bincount(x) + assert_array_equal(x,y) + + def test_empty_with_minlength(self): + x = np.array([], dtype=int) + y = np.bincount(x, minlength=5) + assert_array_equal(y, np.zeros(5, dtype=int)) + + class TestInterp(TestCase): def test_exceptions(self): assert_raises(ValueError, interp, 0, [], []) |