show_unittest_examples.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:OpenMDAO 作者: OpenMDAO 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号