code: def test_basic_aggregation(Aggregation):
      x = torch.randn(6, 16)
      index = torch.tensor([0, 0, 1, 1, 1, 2])
      ptr = torch.tensor([0, 2, 5, 6])
  
      aggr = Aggregation()
      assert str(aggr) == f"{Aggregation.__name__}()"
  
      out = aggr(x, index)
      assert out.size() == (3, x.size(1))
  
      if isinstance(aggr, MulAggregation):
          with pytest.raises(
              NotImplementedError, match="requires 'index'"
          ):
              aggr(x, ptr=ptr)
      elif not torch_geometric.typing.WITH_TORCH_SCATTER:
          with pytest.raises(
              NotImplementedError, match="requires 'index'"
          ):
              aggr(x, ptr=ptr)
      else:
          assert torch.allclose(out, aggr(x, ptr=ptr))
  
file_path: pytorch_geometric/test/nn/aggr/test_basic.py
imports: import pytest
  import torch
  import torch_geometric.typing
  from torch_geometric.nn import MaxAggregation, MeanAggregation, MinAggregation, MulAggregation, PowerMeanAggregation, SoftmaxAggregation, StdAggregation, SumAggregation, VarAggregation
label_desc: Use image node_id 2 for calling a global function with example usage: test_basic_aggregation(Aggregation) without return types