summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/slice_attrs.py
diff options
context:
space:
mode:
authorTom Soulanille <soul@prama.com>2015-09-11 14:31:32 -0700
committerDamien George <damien.p.george@gmail.com>2015-09-15 21:59:20 +0100
commitaeb62f9ae3169d789800591eea390e020c7532bf (patch)
tree6b4524e14756f3cdd2c41ad98b72ab88e40f72ec /tests/basics/slice_attrs.py
parentd80174d7c3fe36f139c639d6a820cc4cbb88ddf9 (diff)
downloadmicropython-aeb62f9ae3169d789800591eea390e020c7532bf.tar.gz
micropython-aeb62f9ae3169d789800591eea390e020c7532bf.zip
py/objslice: Make slice attributes (start/stop/step) readable.
Configurable with MICROPY_PY_BUILTINS_SLICE_ATTRS. Disabled by default.
Diffstat (limited to 'tests/basics/slice_attrs.py')
-rw-r--r--tests/basics/slice_attrs.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/basics/slice_attrs.py b/tests/basics/slice_attrs.py
new file mode 100644
index 0000000000..76368a78c6
--- /dev/null
+++ b/tests/basics/slice_attrs.py
@@ -0,0 +1,16 @@
+# test builtin slice attributes access
+
+# print slice attributes
+class A:
+ def __getitem__(self, idx):
+ print(idx.start, idx.stop, idx.step)
+
+try:
+ t = A()[1:2]
+except:
+ import sys
+ print("SKIP")
+ sys.exit()
+
+
+A()[1:2:3]