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

17 lines
411 B
Python

from __future__ import (absolute_import, division, print_function,
unicode_literals)
import libfoolang
ctx = libfoolang.AnalysisContext()
unit = ctx.get_from_file('foo.txt')
for node in unit.root.findall(lambda _: True):
print('{} node: {}'.format(
'Ghost' if node.is_ghost else 'Regular',
node
))
assert not node.text or not node.is_ghost
print('Done.')