code: def test_getlength(mode, text, direction, expected):
      ttf = ImageFont.truetype(FONT_PATH, FONT_SIZE)
      im = Image.new(mode, (1, 1), 0)
      d = ImageDraw.Draw(im)
  
      try:
          assert d.textlength(text, ttf, direction) == expected
      except ValueError as ex:
          if (
              direction == "ttb"
              and str(ex)
              == "libraqm 0.7 or greater required for 'ttb' direction"
          ):
              pytest.skip("libraqm 0.7 or greater not available")
  
imports: from __future__ import annotations
  import pytest
  from PIL import Image, ImageDraw, ImageFont
  from .helper import assert_image_similar_tofile, skip_unless_feature
label_desc: Use image node_id 15 for calling a global function with example usage: test_getlength(mode, text, direction, expected) without return types