summaryrefslogtreecommitdiff
path: root/tests/basics/builtin_enumerate.py
blob: 29b1dd46c40eaa553f99eb701f5847224e554c99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
print(list(enumerate([])))
print(list(enumerate([1, 2, 3])))
print(list(enumerate([1, 2, 3], 5)))
print(list(enumerate([1, 2, 3], -5)))
print(list(enumerate(range(100))))

# specifying args with keywords
print(list(enumerate([1, 2, 3], start=1)))
print(list(enumerate(iterable=[1, 2, 3])))
print(list(enumerate(iterable=[1, 2, 3], start=1)))

# check handling of extra positional args (exercises some logic in mp_arg_parse_all)
# don't print anything because it doesn't error with MICROPY_CPYTHON_COMPAT disabled
try:
    enumerate([], 1, 2)
except TypeError:
    pass