def print_timing(self):
# Print the timing of mark_tokens(). This doesn't normally run as a unittest, but if you'd like
# to see timings, e.g. while optimizing the implementation, run this to see them:
#
# nosetests -m print_timing -s tests.test_mark_tokens tests.test_astroid
#
# pylint: disable=no-self-use
import timeit
print("mark_tokens", sorted(timeit.repeat(
setup=textwrap.dedent(
'''
import ast, asttokens
source = "foo(bar(1 + 2), 'hello' + ', ' + 'world')"
atok = asttokens.ASTTokens(source)
tree = ast.parse(source)
'''),
stmt='atok.mark_tokens(tree)',
repeat=3,
number=1000)))
评论列表
文章目录