def runTest(self):
"""Makes a simple test of the output"""
body = ast.parse(self.candidate_code, self.file_name, 'exec')
code = compile(self.candidate_code, self.file_name, 'exec', optimize=0)
exec(code)
if_statements = [
node
for node in ast.walk(body)
if isinstance(node, ast.If)
]
self.assertGreater(len(if_statements),
0,
"Should have at least on if statement")
self.assertMultiLineEqual(self.correct_output,
self.__mockstdout.getvalue(),
"Output should be correct")
评论列表
文章目录