circuitpython/tests/basics/slice_op.py
David Lechner 8491eb190f py/objslice: Ensure slice is not hashable.
As per https://bugs.python.org/issue408326, the slice object should not be
hashable.  Since MicroPython has an implicit fallback when the unary_op
slot is empty, we need to fill this slot.

Signed-off-by: David Lechner <david@pybricks.com>
2023-05-19 12:06:06 +10:00

16 lines
276 B
Python

try:
t = [][:]
except:
print("SKIP")
raise SystemExit
# REVISIT: slice comparison operators are not implemented in MicroPython
# test that slice is not hashable, i.e. it can't be used to copy a dict
try:
{}[:] = {}
except TypeError:
print('TypeError')