code: def test_export_community_datasets(tmp_path):
      # Create the community dataset repositories
      tfg_path = _write_dataset_files(
          tmp_path,
          namespace="tensorflow_graphics",
          ds_files={
              "cifar": ["cifar.py", "__init__.py", "empty_dir"],
              "empty_dir": [],
          },
      )
      nlp_path = _write_dataset_files(
          tmp_path,
          namespace="nlp",
          ds_files={
              "mnist": ["mnist.py"],
              "robotnet": ["robotnet.py", "checksums.tsv", "label.txt"],
              "invalid_ds": ["name_do_not_match.py"],
          },
      )
  
      # Write a dummy `community-datasets.toml`
      in_path = tmp_path / "config.toml"
      in_path.write_text(
          textwrap.dedent(
              f"""\
            [Namespaces]
            tensorflow_graphics = '{tfg_path}'
            nlp = '{nlp_path}'
            """
          )
      )
  
      # Load registered dataset and export the list.
      # We patch `GithubPath` with `pathlib.Path` as the two have the same API.
      out_path = tmp_path / "out.jsonl"
      export_community_datasets.export_community_datasets(
          in_path, out_path
      )
  
      # Ensure datasets where correctly exported
      expected_output = textwrap.dedent(
          """\
        {"name": "nlp:mnist", "source": "${nlp_path}/mnist/mnist.py"}
        {"name": "nlp:robotnet", "source": {"root_path": "${nlp_path}/robotnet", "filenames": ["checksums.tsv", "label.txt", "robotnet.py"]}}
        {"name": "tensorflow_graphics:cifar", "source": "${tfg_path}/cifar/cifar.py"}
        """
      )
      expected_output = string.Template(expected_output).substitute(
          tfg_path=tfg_path,
          nlp_path=nlp_path,
      )
      assert out_path.read_text() == expected_output
  
file_path: datasets/tensorflow_datasets/scripts/deployment/export_community_datasets_test.py
imports: import pathlib
  import string
  import textwrap
  from typing import Dict, List
  import tensorflow_datasets
  from tensorflow_datasets.scripts.deployment import export_community_datasets
  import toml
label_desc: Use image node_id 2 for calling a global function with example usage: test_export_community_datasets(tmp_path) without return types