code: def test_generate_examples_duplicated_label_key(
      files_with_labels_and_duplicated_label_key_in_metadata,
      drop_metadata,
      drop_labels,
      cache_dir,
      caplog,
  ):
      (
          class0_file,
          class1_file,
          metadata_file,
      ) = files_with_labels_and_duplicated_label_key_in_metadata
      autofolder = DummyFolderBasedBuilder(
          data_files=[class0_file, class1_file, metadata_file],
          cache_dir=cache_dir,
          drop_metadata=drop_metadata,
          drop_labels=drop_labels,
      )
      gen_kwargs = autofolder._split_generators(
          StreamingDownloadManager()
      )[0].gen_kwargs
      generator = autofolder._generate_examples(**gen_kwargs)
      if drop_labels is False:
          # infer labels from directories even if metadata files are found
          warning_in_logs = any(
              "ignoring metadata columns" in record.msg.lower()
              for record in caplog.records
          )
          assert (
              warning_in_logs
              if drop_metadata is not True
              else not warning_in_logs
          )
          assert autofolder.info.features["label"] == ClassLabel(
              names=["class0", "class1"]
          )
          assert all(
              example["label"] in ["class0", "class1"]
              for _, example in generator
          )
  
      else:
          if drop_metadata is not True:
              # labels are from metadata
              assert autofolder.info.features["label"] == Value(
                  "string"
              )
              assert all(
                  example["label"] in ["CLASS_0", "CLASS_1"]
                  for _, example in generator
              )
          else:
              # drop both labels and metadata
              assert autofolder.info.features == Features({"base": {}})
              assert all(
                  example.keys() == {"base"} for _, example in generator
              )
  
imports: import importlib
  import shutil
  import textwrap
  import pytest
  from datasets import ClassLabel, DownloadManager, Features, Value
  from datasets.data_files import DataFilesDict, get_data_patterns
  from datasets.download.streaming_download_manager import StreamingDownloadManager
  from datasets.packaged_modules.folder_based_builder.folder_based_builder import FolderBasedBuilder, FolderBasedBuilderConfig
  from datasets.tasks import TextClassification
label_desc: Use image node_id 15 for calling a global function with example usage: test_generate_examples_duplicated_label_key(files_with_labels_and_duplicated_label_key_in_metadata, drop_metadata, drop_labels, cache_dir, caplog) without return types