code: def test_preprocessor(
      batch_size,
      output_size,
      input_tensor,
      expected_batches,
      expected_value,
  ):
      processor = PreProcessor(output_size, batch_size)
  
      # Invalid input type
      with pytest.raises(TypeError):
          processor(42)
      # 4D check
      with pytest.raises(AssertionError):
          processor(np.full((256, 128, 3), 255, dtype=np.uint8))
      with pytest.raises(TypeError):
          processor(np.full((1, 256, 128, 3), 255, dtype=np.int32))
      # 3D check
      with pytest.raises(AssertionError):
          processor([np.full((3, 256, 128, 3), 255, dtype=np.uint8)])
      with pytest.raises(TypeError):
          processor([np.full((256, 128, 3), 255, dtype=np.int32)])
  
      with torch.no_grad():
          out = processor(input_tensor)
      assert isinstance(out, list) and len(out) == expected_batches
      assert all(isinstance(b, torch.Tensor) for b in out)
      assert all(b.dtype == torch.float32 for b in out)
      assert all(b.shape[-2:] == output_size for b in out)
      assert all(torch.all(b == expected_value) for b in out)
      assert len(repr(processor).split("\n")) == 4
  
imports: import numpy
  import pytest
  import torch
  from doctr.models.preprocessor import PreProcessor
label_desc: Use image node_id 1 for calling a global function with example usage: test_preprocessor(batch_size, output_size, input_tensor, expected_batches, expected_value) without return types