def run(self):
# create a list of document nodes to return
doc_nodes = []
for arg in self.arguments:
# grabbing a list of the code segments that contain the
# title, source, and output of a test segment.
codelist = get_test_source_code_for_feature(arg)
for code in codelist:
(title, src, output) = code
# the title can be contained in a special title node
title_node = nodes.line(title, title)
# we want the body of test code to be formatted and code highlighted
body = nodes.literal_block(src, src)
body['language'] = 'python'
# we want the output block to also be formatted similarly
output_node = nodes.literal_block(output, output)
# put the nodes we've created in the list, and return them
doc_nodes.append(title_node)
doc_nodes.append(body)
doc_nodes.append(output_node)
return doc_nodes
评论列表
文章目录