def METHOD_NAME(monkeypatch, capsys) -> None:
    class MyObject(Generic):
        def action(self, pose: Pose, *, an: None | str = None) -> None:
            pass
        action.__action__ = ActionMetadata()  # type: ignore
    # @action tries to read from stdin
    sio = io.StringIO()
    sio.fileno = lambda: 0  # type: ignore  # fake whatever fileno
    monkeypatch.setattr("sys.stdin", sio)
    obj_id = "123"
    pose = Pose(Position(0, 0, 0), Orientation(1, 0, 0, 0))
    setattr(pose, AP_ID_ATTR, "pose")  # set pose id (simulate pose declaration in scene json)
    my_obj = MyObject(obj_id, "")
    my_obj.action(pose)
    assert action._executed_action is None
    out_before, _ = capsys.readouterr()
    assert not out_before
    patch_object_actions(MyObject)
    setattr(MyObject, ACTION_NAME_ID_MAPPING_ATTR, {"name": "id"})  # this simulates what patch_with_action_mapping does
    my_obj.action(pose, an="name")
    assert action._executed_action is None
    out_after, _ = capsys.readouterr()
    arr = out_after.strip().split("\n")
    assert len(arr) == 2
    before_evt = ActionStateBefore.from_json(arr[0])
    after_evt = ActionStateAfter.from_json(arr[1])
    assert before_evt.data.action_id == "id"
    assert after_evt.data.action_id == "id"
    assert before_evt.data.action_point_ids is not None
    assert "pose" in before_evt.data.action_point_ids
    with pytest.raises(Arcor2Exception):
        my_obj.action(pose)
    assert action._executed_action is None
    with pytest.raises(Arcor2Exception):
        my_obj.action(pose, an="unknown_action_name")
    assert action._executed_action is None