code: def test_artefact_detection(
      input_size, num_samples, rotate, mock_doc_artefacts
  ):
      # monkeypatch the path to temporary dataset
      datasets.DocArtefacts.URL = mock_doc_artefacts
      datasets.DocArtefacts.SHA256 = None
  
      ds = datasets.DocArtefacts(
          train=True,
          download=True,
          img_transforms=Resize(input_size),
          use_polygons=rotate,
          cache_dir="/".join(mock_doc_artefacts.split("/")[:-2]),
          cache_subdir=mock_doc_artefacts.split("/")[-2],
      )
  
      assert len(ds) == num_samples
      assert repr(ds) == f"DocArtefacts(train={True})"
      _validate_dataset(
          ds, input_size, class_indices=True, is_polygons=rotate
      )
  
imports: import os
  from shutil import move
  import numpy
  import pytest
  import torch
  from torch.utils.data import DataLoader, RandomSampler
  from doctr import datasets
  from doctr.file_utils import CLASS_NAME
  from doctr.transforms import Resize
label_desc: Use image node_id 9 for calling a global function with example usage: test_artefact_detection(input_size, num_samples, rotate, mock_doc_artefacts) without return types