def test_lineno_after_implicit_return(self):
    TRUE = True

    def if1(x):
        x()
        if TRUE:
            pass

    def if2(x):
        x()
        if TRUE:
            pass
        else:
            pass

    def if3(x):
        x()
        if TRUE:
            pass
        else:
            return None

    def if4(x):
        x()
        if (not TRUE):
            pass
    funcs = [if1, if2, if3, if4]
    lastlines = [3, 3, 3, 2]
    frame = None

    def save_caller_frame():
        nonlocal frame
        frame = sys._getframe(1)
    for (func, lastline) in zip(funcs, lastlines, strict=True):
        with self.subTest(func=func):
            func(save_caller_frame)
            self.assertEqual((frame.f_lineno - frame.f_code.co_firstlineno), lastline)
def test_lineno_after_implicit_return(self):
    TRUE = True

    def if1(x):
        x()
        if TRUE:
            pass

    def if2(x):
        x()
        if TRUE:
            pass
        else:
            pass

    def if3(x):
        x()
        if TRUE:
            pass
        else:
            return None

    def if4(x):
        x()
        if (not TRUE):
            pass
    funcs = [if1, if2, if3, if4]
    lastlines = [3, 3, 3, 2]
    frame = None

    def save_caller_frame():
        nonlocal frame
        frame = sys._getframe(1)
    for (func, lastline) in zip(funcs, lastlines, strict=True):
        with self.subTest(func=func):
            func(save_caller_frame)
            self.assertEqual((frame.f_lineno - frame.f_code.co_firstlineno), lastline)