code: def test_cursor_up(_buffer):
      # Cursor up to a line thats longer.
      _buffer.insert_text("long line1\nline2")
      _buffer.cursor_up()
  
      assert _buffer.document.cursor_position == 5
  
      # Going up when already at the top.
      _buffer.cursor_up()
      assert _buffer.document.cursor_position == 5
  
      # Going up to a line that's shorter.
      _buffer.reset()
      _buffer.insert_text("line1\nlong line2")
  
      _buffer.cursor_up()
      assert _buffer.document.cursor_position == 5
  
file_path: catboost/contrib/python/prompt-toolkit/py3/tests/test_buffer.py
imports: from __future__ import annotations
  import pytest
  from prompt_toolkit.buffer import Buffer
label_desc: Use image node_id 6 for calling a global function with example usage: test_cursor_up(_buffer) without return types