mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Support slice hash (#5123)
* make slice object hashable * Update test_slice.py from CPython v3.12 * remove TODO * remove outdated tests
This commit is contained in:
1 parent
8fc2c39d62
commit
dc4f6994fb
3 files changed
+92
-16
No files matched your search
@@ -82,16 +82,6 @@ assert_raises(TypeError, lambda: slice(0) > 3)
|
||||
assert_raises(TypeError, lambda: slice(0) <= 3)
|
||||
assert_raises(TypeError, lambda: slice(0) >= 3)
|
||||
|
||||
# TODO: slice is hashable in CPython 3.12
|
||||
# assert_raises(TypeError, hash, slice(0))
|
||||
# assert_raises(TypeError, hash, slice(None))
|
||||
#
|
||||
# def dict_slice():
|
||||
# d = {}
|
||||
# d[slice(0)] = 3
|
||||
#
|
||||
# assert_raises(TypeError, dict_slice)
|
||||
|
||||
assert slice(None ).indices(10) == (0, 10, 1)
|
||||
assert slice(None, None, 2).indices(10) == (0, 10, 2)
|
||||
assert slice(1, None, 2).indices(10) == (1, 10, 2)
|
||||
|
||||
Reference in new issue
Block a user