code: def test_deskew(resources, outdir):
      # Run with deskew
      deskewed_pdf = check_ocrmypdf(
          resources / "skew.pdf", outdir / "skew.pdf", "-d"
      )
  
      # Now render as an image again...
      deskewed_png = outdir / "deskewed.png"
  
      ghostscript.rasterize_pdf(
          deskewed_pdf,
          deskewed_png,
          raster_device="pngmono",
          raster_dpi=Resolution(150, 150),
          pageno=1,
      )
  
      # ...and use Tessera to find the skew angle to confirm that it was deskewed
      skew_angle = tesseract.get_deskew(deskewed_png, [], None, 5.0)
      print(skew_angle)
      assert -0.5 < skew_angle < 0.5, "Deskewing failed"
  
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 1 for calling a global function with example usage: test_deskew(resources, outdir) without return types