def METHOD_NAME(self):
    cu = torch.jit.CompilationUnit('''
        def foo(cond):
            assert bool(cond), "hi"
            return 0
    ''')
    cu.foo(torch.tensor(1))
    with self.assertRaisesRegex(torch.jit.Error, "AssertionError: hi"):
        cu.foo(torch.tensor(0))
    @torch.jit.script
    def foo(cond):
        assert bool(cond), "hi"
    foo(torch.tensor(1))
    # we don't currently validate the name of the exception
    with self.assertRaisesRegex(torch.jit.Error, "AssertionError: hi"):
        foo(torch.tensor(0))