def METHOD_NAME(self):
    """Only top-level function is allowed, function associated with a class will raise a
    message"""
    src = """
    class Example:
        def my_function(self):
            name = input()
            return name
    """
    mod = astroid.parse(src)
    call, *_ = mod.nodes_of_class(nodes.Call)
    with self.assertAddsMessages(
        pylint.testutils.MessageTest(
            msg_id="forbidden-IO-function", node=call, args=call.func.name
        ),
        ignore_position=True,
    ):
        self.checker.visit_call(call)