diff options
author | Alex <aprockhill206@gmail.com> | 2020-05-14 18:47:59 -0700 |
---|---|---|
committer | Alex <aprockhill206@gmail.com> | 2020-07-22 11:59:30 -0700 |
commit | 8066b45451eff24228bb5af96aad2fe0bd548383 (patch) | |
tree | 83864ac983af6b18ef43ca8c728d875a2b1c345b /numpy/lib/tests | |
parent | a39e3021b9304fb5a76542d444b7fec2dcff1374 (diff) | |
download | numpy-8066b45451eff24228bb5af96aad2fe0bd548383.tar.gz |
edge first try
ENH: added edge keyword argument to digitize
added test
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index eb2fc3311..35225ff21 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1712,6 +1712,9 @@ class TestDigitize: bins = [1, 1, 0] assert_array_equal(digitize(x, bins, False), [3, 2, 0, 0]) assert_array_equal(digitize(x, bins, True), [3, 3, 2, 0]) + bins = [-1, 0, 1, 2] + assert_array_equal(digitize(x, bins, False, True), [1, 2, 3, 3]) + assert_array_equal(digitize(x, bins, True, True), [1, 1, 2, 3]) bins = [1, 1, 1, 1] assert_array_equal(digitize(x, bins, False), [0, 0, 4, 4]) assert_array_equal(digitize(x, bins, True), [0, 0, 0, 4]) @@ -1740,6 +1743,7 @@ class TestDigitize: # gh-11022 x = 2**54 # loses precision in a float assert_equal(np.digitize(x, [x - 1, x + 1]), 1) + assert_raises(ValueError, digitize, x, [x - 1, x + 1], False, True) @pytest.mark.xfail( reason="gh-11022: np.core.multiarray._monoticity loses precision") |