code: def test_extract_features_values():
      features = features_lib.FeaturesDict(
          {
              "img": features_lib.Image(shape=(256, 256, 3)),
              "img2": features_lib.Image(shape=(256, 256, 3)),
              "metadata": {
                  "label": features_lib.ClassLabel(num_classes=4),
                  "other": tf.string,
              },
              "sequence": features_lib.Sequence(
                  {
                      "x": tf.int64,
                      "y": tf.int64,
                  }
              ),
              "sequence_flat": features_lib.Sequence(tf.int64),
          }
      )
  
      result = _extract_features(
          feature=features,
          expected_feature={
              "img": True,
              "img2": False,
              "unknown_key": False,  # Extra keys are filtered
              "metadata": ["label"],
              "sequence": {"y"},
              "sequence_flat": True,
          },
      )
      testing.assert_features_equal(
          result,
          features_lib.FeaturesDict(
              {
                  "img": features_lib.Image(shape=(256, 256, 3)),
                  "metadata": {
                      "label": features_lib.ClassLabel(num_classes=4),
                  },
                  "sequence": features_lib.Sequence(
                      {
                          "y": tf.int64,
                      }
                  ),
                  "sequence_flat": features_lib.Sequence(tf.int64),
              }
          ),
      )
  
      result = _extract_features(
          feature=features,
          expected_feature={"metadata", "sequence"},
      )
      testing.assert_features_equal(
          result,
          features_lib.FeaturesDict(
              {
                  "metadata": {
                      "label": features_lib.ClassLabel(num_classes=4),
                      "other": tf.string,
                  },
                  "sequence": features_lib.Sequence(
                      {
                          "x": tf.int64,
                          "y": tf.int64,
                      }
                  ),
              }
          ),
      )
  
      # Test, mixing Features with non-features.
      result = _extract_features(
          feature=features,
          expected_feature={
              "img": features_lib.Image(),
              "sequence": {
                  "x": tf.int64,
                  "y": False,
              },
          },
      )
      testing.assert_features_equal(
          result,
          features_lib.FeaturesDict(
              {
                  "img": features_lib.Image(shape=(256, 256, 3)),
                  "sequence": features_lib.Sequence(
                      {
                          "x": tf.int64,
                      }
                  ),
              }
          ),
      )
  
file_path: datasets/tensorflow_datasets/core/decode/partial_decode_test.py
imports: import pytest
  import tensorflow
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import decode
  from tensorflow_datasets.core import features
label_desc: Use image node_id 3 for calling a global function with example usage: test_extract_features_values() without return types