def METHOD_NAME(self):
    global FILE
    FILE = StringIO()
    cnt = torch._dynamo.testing.CompileCounter()
    @torch._dynamo.optimize(cnt)
    def f(x):
        y = x * 2
        @comptime
        def _(ctx):
            ctx.print_guards(file=FILE)
        comptime.print_guards()
        return y + 3
    f(torch.randn(2))
    self.assertEqual(cnt.frame_count, 1)
    self.assertExpectedInline(
        re.sub(r"\s+$", "", FILE.getvalue().rstrip(), flags=re.MULTILINE),
        """\
    local "L['x']" TENSOR_MATCH
    {
        'guard_types': None,
        'code': None,
        'obj_weakref': None
        'guarded_class': None
    }
    global '' GRAD_MODE
    {
        'guard_types': None,
        'code': None,
        'obj_weakref': None
        'guarded_class': None
    }
    global '' DETERMINISTIC_ALGORITHMS
    {
        'guard_types': None,
        'code': None,
        'obj_weakref': None
        'guarded_class': None
    }
    global '' TORCH_FUNCTION_STATE
    {
        'guard_types': None,
        'code': None,
        'obj_weakref': None
        'guarded_class': None
    }
    global '' DEFAULT_DEVICE
    {
        'guard_types': None,
        'code': None,
        'obj_weakref': None
        'guarded_class': None
    }
    shape_env '' SHAPE_ENV
    {
        'guard_types': None,
        'code': None,
        'obj_weakref': None
        'guarded_class': None
    }""",
    )