code: def test_beam(
      tmp_path: pathlib.Path,
      split_builder: split_builder_lib.SplitBuilder,
  ):
      """Test that `maybe_beam_pipeline` behave as `beam.Pipeline()`."""
      path = tmp_path / "out.txt"
      with split_builder.maybe_beam_pipeline() as pipeline_proxy:
          ptransform = (
              beam.Create(range(9))
              | beam.Map(lambda x: x * 10)
              | beam.Map(_inc_placeholder_counter)
              | beam.io.WriteToText(
                  os.fspath(path), shard_name_template=""
              )
          )
          _ = split_builder.beam_pipeline | ptransform
      result = pipeline_proxy.result
      # counters = metrics.get_metrics(result, 'some_namespace').counters
      mfilter = beam.metrics.MetricsFilter().with_namespaces(
          ["some_namespace"]
      )
      all_metrics = result.metrics().query(mfilter)
      counters = all_metrics["counters"]
      assert counters[0].key.metric.name == "some_counter"
      assert counters[0].committed == 9
      assert (
          path.read_text()
          == "\n".join(str(x * 10) for x in range(9)) + "\n"
      )
  
file_path: datasets/tensorflow_datasets/core/split_builder_test.py
imports: import collections
  import io
  import os
  import pathlib
  import apache_beam
  import psutil
  import pytest
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import split_builder
label_desc: Use image node_id 3 for calling a global function with example usage: test_beam(tmp_path, split_builder) without return types