def METHOD_NAME(self, pyfunc, flags=force_pyobj_flags, exc=ValueError):
    with self.assertRaises(exc):
        cr = compile_isolated(pyfunc, (), flags=flags)
        cfunc = cr.entry_point
        cfunc()