parameters: (
          all_extra_metadata: BuildDict, bazel_rules: BuildDict)
docstring: Patches test build metadata with transitive metadata.
docstring_summary: Patches test build metadata with transitive metadata.
docstring_tokens: Patches test build metadata with transitive metadata .
function: def update_test_metadata_with_transitive_metadata(
          all_extra_metadata: BuildDict, bazel_rules: BuildDict) -> None:
      """Patches test build metadata with transitive metadata."""
      for lib_name, lib_dict in list(all_extra_metadata.items()):
          # Skip if it isn't not an test
          if lib_dict.get('build') != 'test' or lib_dict.get('_TYPE') != 'target':
              continue
  
          bazel_rule = bazel_rules[_get_bazel_label(lib_name)]
  
          if '//external:benchmark' in bazel_rule['_TRANSITIVE_DEPS']:
              lib_dict['benchmark'] = True
              lib_dict['defaults'] = 'benchmark'
  
          if '//external:gtest' in bazel_rule['_TRANSITIVE_DEPS']:
              lib_dict['gtest'] = True
              lib_dict['language'] = 'c++'
function_tokens: def update_test_metadata_with_transitive_metadata ( all_extra_metadata : BuildDict , bazel_rules : BuildDict ) -> None : for lib_name , lib_dict in list ( all_extra_metadata . items ( ) ) : # Skip if it isn't not an test if lib_dict . get ( 'build' ) != 'test' or lib_dict . get ( '_TYPE' ) != 'target' : continue bazel_rule = bazel_rules [ _get_bazel_label ( lib_name ) ] if '//external:benchmark' in bazel_rule [ '_TRANSITIVE_DEPS' ] : lib_dict [ 'benchmark' ] = True lib_dict [ 'defaults' ] = 'benchmark' if '//external:gtest' in bazel_rule [ '_TRANSITIVE_DEPS' ] : lib_dict [ 'gtest' ] = True lib_dict [ 'language' ] = 'c++'