code: def test_validate_aggregation():
      string_cases = ["max", "min", "mean", "median", "count", "sum"]
      func_cases = {
          np.min: "min",
          min: "min",
          np.max: "max",
          max: "max",
          np.sum: "sum",
          sum: "sum",
          np.median: "median",
          np.mean: "mean",
      }
  
      for case in string_cases:
          assert validate_aggregation(case) == case
  
      for case, result in func_cases.items():
          assert validate_aggregation(case) == result
  
      assert validate_aggregation(None) is None
  
      with pytest.raises(ValueError) as err:
          validate_aggregation("blah")
      assert str(err.value).startswith(
          "Unrecognized Vega-Lite aggregation"
      )
  
      with pytest.raises(ValueError) as err:
          validate_aggregation(np.array)
      assert str(err.value).startswith(
          "Unrecognized Vega-Lite aggregation"
      )
  
imports: import pytest
  import pandas
  import numpy
  from pdvega._utils import infer_vegalite_type, unpivot_frame, validate_aggregation
label_desc: Use image node_id 4 for calling a global function with example usage: test_validate_aggregation() without return types