diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-07-23 07:40:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-23 07:40:37 +0300 |
commit | c3a887e55e0a14e3a31460e7a79e5f7f965fea68 (patch) | |
tree | 3d6817b928b2a1e543ee37644ea6ba3d4d5bfe13 /numpy/lib/tests/test_function_base.py | |
parent | a39e3021b9304fb5a76542d444b7fec2dcff1374 (diff) | |
parent | 325fbe4c90b0f499ccbd7750bd628dc8cebbcfbc (diff) | |
download | numpy-c3a887e55e0a14e3a31460e7a79e5f7f965fea68.tar.gz |
Merge pull request #16248 from alexrockhill/edge
MRG, ENH: added edge keyword argument to digitize
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index eb2fc3311..32f660772 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -1712,6 +1712,12 @@ 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 = [2, 1, 0, -1] + assert_array_equal(digitize(x, bins, False, True), [3, 2, 1, 1]) + assert_array_equal(digitize(x, bins, True, True), [3, 3, 2, 1]) 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 +1746,7 @@ class TestDigitize: # gh-11022 x = 2**54 # loses precision in a float assert_equal(np.digitize(x, [x - 1, x + 1]), 1) + assert_equal(np.digitize(x, [x - 1, x + 1], False, True), 1) @pytest.mark.xfail( reason="gh-11022: np.core.multiarray._monoticity loses precision") |