code: def test_agg_same_method_name(es):
      """
      Pandas relies on the function name when calculating aggregations. This means if a two
      primitives with the same function name are applied to the same column, pandas
      can't differentiate them. We have a work around to this based on the name property
      that we test here.
      """
      # TODO: Update to work with Dask and Spark
      if es.dataframe_type != Library.PANDAS:
          pytest.xfail(
              "Need to update to work with Dask and Spark EntitySets"
          )
  
      # test with normally defined functions
      class Sum(AggregationPrimitive):
          name = "sum"
          input_types = [ColumnSchema(semantic_tags={"numeric"})]
          return_type = ColumnSchema(semantic_tags={"numeric"})
  
          def get_function(self):
              def custom_primitive(x):
                  return x.sum()
  
              return custom_primitive
  
      class Max(AggregationPrimitive):
          name = "max"
          input_types = [ColumnSchema(semantic_tags={"numeric"})]
          return_type = ColumnSchema(semantic_tags={"numeric"})
  
          def get_function(self):
              def custom_primitive(x):
                  return x.max()
  
              return custom_primitive
  
      f_sum = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=Sum,
      )
      f_max = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=Max,
      )
  
      fm = calculate_feature_matrix([f_sum, f_max], entityset=es)
      assert fm.columns.tolist() == [f_sum.get_name(), f_max.get_name()]
  
      # test with lambdas
      class Sum(AggregationPrimitive):
          name = "sum"
          input_types = [ColumnSchema(semantic_tags={"numeric"})]
          return_type = ColumnSchema(semantic_tags={"numeric"})
  
          def get_function(self):
              return lambda x: x.sum()
  
      class Max(AggregationPrimitive):
          name = "max"
          input_types = [ColumnSchema(semantic_tags={"numeric"})]
          return_type = ColumnSchema(semantic_tags={"numeric"})
  
          def get_function(self):
              return lambda x: x.max()
  
      f_sum = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=Sum,
      )
      f_max = Feature(
          es["log"].ww["value"],
          parent_dataframe_name="customers",
          primitive=Max,
      )
      fm = calculate_feature_matrix([f_sum, f_max], entityset=es)
      assert fm.columns.tolist() == [f_sum.get_name(), f_max.get_name()]
  
imports: from datetime import datetime
  from inspect import isclass
  from math import isnan
  import numpy
  import pandas
  import pytest
  from woodwork.column_schema import ColumnSchema
  from woodwork.logical_types import Datetime
  from featuretools import AggregationFeature, Feature, IdentityFeature, Timedelta, calculate_feature_matrix, dfs, primitives
  from featuretools.entityset.relationship import RelationshipPath
  from featuretools.feature_base.cache import feature_cache
  from featuretools.primitives import Count, Max, Mean, Median, NMostCommon, NumTrue, NumUnique, Sum, TimeSinceFirst, TimeSinceLast, get_aggregation_primitives
  from featuretools.primitives.base import AggregationPrimitive
  from featuretools.synthesis.deep_feature_synthesis import DeepFeatureSynthesis, match
  from featuretools.tests.testing_utils import backward_path, feature_with_name, to_pandas
  from featuretools.utils.gen_utils import Library
label_desc: Use image node_id 18 for calling a global function with example usage: test_agg_same_method_name(es) and returns: custom_primitive, custom_primitive, function, function, x, x