code: def test_input_transform():
      def fn(x):
          return x + 1
  
      class MyTransform(InputTransform):
          def train_per_batch_transform(self) -> Callable:
              return self.train_per_batch_transform
  
      transform = MyTransform()
  
      # Tests for RunningStage.TRAINING
      transform._populate_transforms_for_stage(RunningStage.TRAINING)
      train_transforms = transform._transform[
          RunningStage.TRAINING
      ].transforms
      assert list(train_transforms.keys()) == [
          "per_batch_transform",
          "collate",
      ]
      assert (
          train_transforms["per_batch_transform"]
          == transform.train_per_batch_transform
      )
  
      class MyTransform(InputTransform):
          def per_batch_transform(self) -> Callable:
              return self.per_batch_transform
  
          def train_collate(self) -> Callable:
              return self.train_collate
  
          def collate(self) -> Callable:
              return self.collate
  
      transform = MyTransform()
  
      # Tests for RunningStage.TRAINING
      transform._populate_transforms_for_stage(RunningStage.TRAINING)
      train_transforms = transform._transform[
          RunningStage.TRAINING
      ].transforms
      assert list(train_transforms.keys()) == [
          "per_batch_transform",
          "collate",
      ]
      assert (
          train_transforms["per_batch_transform"]
          == transform.per_batch_transform
      )
      assert train_transforms["collate"] == transform.train_collate
  
      # Tests for RunningStage.VALIDATING
      transform._populate_transforms_for_stage(RunningStage.VALIDATING)
      val_transforms = transform._transform[
          RunningStage.VALIDATING
      ].transforms
      assert list(val_transforms.keys()) == [
          "per_batch_transform",
          "collate",
      ]
      assert (
          val_transforms["per_batch_transform"]
          == transform.per_batch_transform
      )
      assert val_transforms["collate"] == transform.collate
  
      class MyTransform(InputTransform):
          def __init__(self, value: int):
              super().__init__()
              self.value = value
  
          def per_batch_transform(self) -> Callable:
              if self.value > 0:
                  return self.per_batch_transform
              return super().per_batch_transform
  
      with pytest.raises(AttributeError, match="__init__"):
          MyTransform(1)
  
      class MyTransform(InputTransform):
          def __init__(self, value: int):
              self.value = value
              super().__init__()
  
          def per_batch_transform(self) -> Callable:
              if self.value > 0:
                  return self.per_batch_transform
              return super().per_batch_transform
  
      MyTransform(1)
  
imports: from typing import Callable
  import pytest
  from flash.core.data.io.input_transform import InputTransform
  from flash.core.utilities.imports import _TOPIC_CORE_AVAILABLE
  from flash.core.utilities.stages import RunningStage
label_desc: Use image node_id 1 for calling a global function with example usage: test_input_transform() and returns: unknown, self, self, self, self, super, super, self, self