summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_index_tricks.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-12-02 20:22:00 -0600
committerSebastian Berg <sebastian@sipsolutions.net>2020-12-02 20:25:16 -0600
commitd54e2dcc17e0f0a8702d4b0eb4ac30a5c927a056 (patch)
tree6e0bfbef7d17f3907c03a1b7e54e54431c12bfd1 /numpy/lib/tests/test_index_tricks.py
parente481e39350847af034bbab8e1237ef0085714886 (diff)
downloadnumpy-d54e2dcc17e0f0a8702d4b0eb4ac30a5c927a056.tar.gz
DEP: Finalize unravel_index `dims` alias for `shape` keyword
The argument was renamed to `shape` and deprecated since NumPy 1.16, so the deprecation can now be finalized.
Diffstat (limited to 'numpy/lib/tests/test_index_tricks.py')
-rw-r--r--numpy/lib/tests/test_index_tricks.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
index 843e27cef..c21aefd1a 100644
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -16,23 +16,13 @@ class TestRavelUnravelIndex:
def test_basic(self):
assert_equal(np.unravel_index(2, (2, 2)), (1, 0))
- # test backwards compatibility with older dims
- # keyword argument; see Issue #10586
- with assert_warns(DeprecationWarning):
- # we should achieve the correct result
- # AND raise the appropriate warning
- # when using older "dims" kw argument
- assert_equal(np.unravel_index(indices=2,
- dims=(2, 2)),
- (1, 0))
-
# test that new shape argument works properly
assert_equal(np.unravel_index(indices=2,
shape=(2, 2)),
(1, 0))
# test that an invalid second keyword argument
- # is properly handled
+ # is properly handled, including the old name `dims`.
with assert_raises(TypeError):
np.unravel_index(indices=2, hape=(2, 2))
@@ -42,6 +32,9 @@ class TestRavelUnravelIndex:
with assert_raises(TypeError):
np.unravel_index(254, ims=(17, 94))
+ with assert_raises(TypeError):
+ np.unravel_index(254, dims=(17, 94))
+
assert_equal(np.ravel_multi_index((1, 0), (2, 2)), 2)
assert_equal(np.unravel_index(254, (17, 94)), (2, 66))
assert_equal(np.ravel_multi_index((2, 66), (17, 94)), 254)