__init__.py 文件源码

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

项目:py101 作者: sophilabs 项目源码 文件源码
def runTest(self):
        """Makes a simple test of the output"""

        body = ast.parse(self.candidate_code, self.file_name, 'exec')

        # Looks if the code is the same as the provided code.
        body_dump = ast.dump(body)
        for node in self.inmutable_code.body:
            self.assertTrue(body_dump.find(ast.dump(node)) >= 0,
                            "Provided code should not be modified")

        code = compile(self.candidate_code, self.file_name, 'exec')
        exec(code)
        self.assertMultiLineEqual('1\n2\n3\n',
                                  self.__mockstdout.getvalue(),
                                  'Output is not correct')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号