def mod(self, mod, msg=None, mode="exec", *, exc=ValueError):
mod.lineno = mod.col_offset = 0
ast.fix_missing_locations(mod)
with self.assertRaises(exc) as cm:
compile(mod, "<test>", mode)
if msg is not None:
self.assertIn(msg, str(cm.exception))
评论列表
文章目录