Files
langkit/testsuite/tests/python-api/node_negative_index/main.py
Pierre-Marie de Rodat 01a080bb7c tests/: update __future__ imports
TN: Q223-029
2017-02-24 11:08:08 +01:00

15 lines
366 B
Python

from __future__ import (absolute_import, division, print_function,
unicode_literals)
import libfoolang
ctx = libfoolang.AnalysisContext()
unit = ctx.get_from_buffer('foo.txt', 'a b c')
for i in range(-4, 5):
try:
child = unit.root[i]
except IndexError:
child = '<IndexError>'
print('i={}: {}'.format(i, child))