artiq/lit-test/compiler/integration/subscript.py
whitequark 20f5f8217d Make sure tests pass both on ARTIQ Python and CPython.
In some cases (the `is` operator and wraparound arithmetics)
the tests will only pass on ARTIQ Python. These are conditionally
commented out.
2015-07-23 08:09:25 +03:00

19 lines
405 B
Python

# RUN: %python -m artiq.compiler.testbench.jit %s
# RUN: %python %s
lst = list(range(10))
assert lst[0] == 0
assert lst[1] == 1
assert lst[-1] == 9
assert lst[0:1] == [0]
assert lst[0:2] == [0, 1]
assert lst[0:10] == lst
assert lst[1:-1] == lst[1:9]
assert lst[0:1:2] == [0]
assert lst[0:2:2] == [0]
assert lst[0:3:2] == [0, 2]
lst = [0, 0, 0, 0, 0]
lst[0:5:2] = [1, 2, 3]
assert lst == [1, 0, 2, 0, 3]