def METHOD_NAME(self):
    def w1():
        warnings.warn("I am warning you")
    def w2():
        warnings.warn("I am warning you")
    @torch.jit.script
    def fn():
        w1()
        w2()
    f = io.StringIO()
    with redirect_stderr(f):
        fn()
    FileCheck() \
        .check_count(
            str="UserWarning: I am warning you",
            count=2,
            exactly=True) \
        .run(f.getvalue())