code: def test_convert_to_square_resolution(renderer, resources, outpdf):
      # Confirm input image is non-square resolution
      in_pageinfo = PdfInfo(resources / "aspect.pdf")
      assert in_pageinfo[0].dpi.x != in_pageinfo[0].dpi.y
  
      # --force-ocr requires means forced conversion to square resolution
      check_ocrmypdf(
          resources / "aspect.pdf",
          outpdf,
          "--force-ocr",
          "--pdf-renderer",
          renderer,
          "--plugin",
          "tests/plugins/tesseract_cache.py",
      )
  
      out_pageinfo = PdfInfo(outpdf)
  
      in_p0, out_p0 = in_pageinfo[0], out_pageinfo[0]
  
      # Resolution show now be equal
      assert out_p0.dpi.x == out_p0.dpi.y
  
      # Page size should match input page size
      assert isclose(in_p0.width_inches, out_p0.width_inches)
      assert isclose(in_p0.height_inches, out_p0.height_inches)
  
      # Because we rasterized the page to produce a new image, it should occupy
      # the entire page
      out_im_w = out_p0.images[0].width / out_p0.images[0].dpi.x
      out_im_h = out_p0.images[0].height / out_p0.images[0].dpi.y
      assert isclose(out_p0.width_inches, out_im_w)
      assert isclose(out_p0.height_inches, out_im_h)
  
file_path: OCRmyPDF/tests/test_preprocessing.py
imports: from __future__ import annotations
  from math import isclose
  import pytest
  from PIL import Image
  from ocrmypdf._exec import ghostscript, tesseract
  from ocrmypdf.helpers import Resolution
  from ocrmypdf.pdfinfo import PdfInfo
  from .conftest import check_ocrmypdf, have_unpaper
label_desc: Use image node_id 6 for calling a global function with example usage: test_convert_to_square_resolution(renderer, resources, outpdf) without return types