code: def test_get_valid_primitives_custom_primitives(pd_es):
      class ThreeMostCommonCat(AggregationPrimitive):
          name = "n_most_common_categorical"
          input_types = [ColumnSchema(semantic_tags={"category"})]
          return_type = ColumnSchema(semantic_tags={"category"})
          number_output_features = 3
  
      class AddThree(TransformPrimitive):
          name = "add_three"
          input_types = [
              ColumnSchema(semantic_tags="numeric"),
              ColumnSchema(semantic_tags="numeric"),
              ColumnSchema(semantic_tags="numeric"),
          ]
          return_type = ColumnSchema(semantic_tags="numeric")
          commutative = True
          compatibility = [Library.PANDAS, Library.DASK, Library.SPARK]
  
      agg_prims, trans_prims = get_valid_primitives(pd_es, "log")
      assert ThreeMostCommonCat not in agg_prims
      assert AddThree not in trans_prims
  
      with pytest.raises(
          ValueError,
          match="'add_three' is not a recognized primitive name",
      ):
          agg_prims, trans_prims = get_valid_primitives(
              pd_es,
              "log",
              2,
              [ThreeMostCommonCat, "add_three"],
          )
  
file_path: featuretools/featuretools/tests/synthesis/test_get_valid_primitives.py
imports: import pytest
  from woodwork.column_schema import ColumnSchema
  from featuretools.primitives import AggregationPrimitive, Count, Hour, IsIn, Not, TimeSincePrevious, TransformPrimitive
  from featuretools.synthesis.get_valid_primitives import get_valid_primitives
  from featuretools.utils.gen_utils import Library
label_desc: Use image node_id 5 for calling a global function with example usage: test_get_valid_primitives_custom_primitives(pd_es) without return types