circuitpython/tests/basics/builtin_enumerate.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
636 B
Python
Raw Permalink Normal View History

try:
enumerate
except:
print("SKIP")
raise SystemExit
2014-01-14 18:55:01 -05:00
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))))
2014-01-14 18:55:01 -05:00
# 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