code: def test_encode_features_handles_dictionary_input(pd_es):
      f1 = IdentityFeature(pd_es["log"].ww["product_id"])
      f2 = IdentityFeature(pd_es["log"].ww["purchased"])
      f3 = IdentityFeature(pd_es["log"].ww["session_id"])
  
      features = [f1, f2, f3]
      feature_matrix = calculate_feature_matrix(
          features, pd_es, instance_ids=range(16)
      )
      feature_matrix_encoded, features_encoded = encode_features(
          feature_matrix, features
      )
      true_values = [
          "product_id = coke zero",
          "product_id = toothpaste",
          "product_id = car",
          "product_id = brown bag",
          "product_id = taco clock",
          "product_id = Haribo sugar-free gummy bears",
          "product_id is unknown",
          "purchased",
          "session_id = 0",
          "session_id = 1",
          "session_id = 4",
          "session_id = 3",
          "session_id = 5",
          "session_id = 2",
          "session_id is unknown",
      ]
      assert len(features_encoded) == 15
      for col in true_values:
          assert col in list(feature_matrix_encoded.columns)
  
      top_n_dict = {}
      feature_matrix_encoded, features_encoded = encode_features(
          feature_matrix,
          features,
          top_n=top_n_dict,
      )
      assert len(features_encoded) == 15
      for col in true_values:
          assert col in list(feature_matrix_encoded.columns)
  
      top_n_dict = {f1.get_name(): 4, f3.get_name(): 3}
      feature_matrix_encoded, features_encoded = encode_features(
          feature_matrix,
          features,
          top_n=top_n_dict,
      )
      assert len(features_encoded) == 10
      true_values = [
          "product_id = coke zero",
          "product_id = toothpaste",
          "product_id = car",
          "product_id = brown bag",
          "product_id is unknown",
          "purchased",
          "session_id = 0",
          "session_id = 1",
          "session_id = 4",
          "session_id is unknown",
      ]
      for col in true_values:
          assert col in list(feature_matrix_encoded.columns)
  
      feature_matrix_encoded, features_encoded = encode_features(
          feature_matrix,
          features,
          top_n=top_n_dict,
          include_unknown=False,
      )
      true_values = [
          "product_id = coke zero",
          "product_id = toothpaste",
          "product_id = car",
          "product_id = brown bag",
          "purchased",
          "session_id = 0",
          "session_id = 1",
          "session_id = 4",
      ]
      assert len(features_encoded) == 8
      for col in true_values:
          assert col in list(feature_matrix_encoded.columns)
  
file_path: featuretools/featuretools/tests/synthesis/test_encode_features.py
imports: import pandas
  import pytest
  from featuretools import EntitySet, calculate_feature_matrix, dfs
  from featuretools.feature_base import Feature, IdentityFeature
  from featuretools.primitives import NMostCommon
  from featuretools.synthesis import encode_features
label_desc: Use image node_id 10 for calling a global function with example usage: test_encode_features_handles_dictionary_input(pd_es) without return types