apache/beam · error · TypeError

f' of test specification missing a name

Error message

f'{attr_type} {ix} of test specification {identifier} missing a name'

What it means

An entry in one of the test spec's element-list attributes (mock_inputs, mock_outputs, expected_outputs, expected_inputs) is a mapping but lacks the required 'name' key. The name identifies which input/output of the transform under test the elements belong to, so validation fails before the entry can be matched to a transform output.

Solutions

  1. Add a 'name' key to the entry matching an input or output name of the transform being tested
  2. For outputs referenced by tag, use the 'transform.output' naming convention in the name field
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sdks/python/apache_beam/yaml/yaml_testing.py:188 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/31657739c11d242e. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/yaml/yaml_testing.py:188

        f'test specification {identifier} '
        f'has unknown attributes {list(unknown_attrs)}')

  for attr_type in ('mock_inputs',
                    'mock_outputs',
                    'expected_outputs',
                    'expected_inputs'):
    attr = test_spec.get(attr_type, [])
    if not isinstance(attr, list):
      raise TypeError(
          f'{attr_type} of test specification {identifier} '
          f'must be a list, got {type(attr_type)}')
    for ix, attr_item in enumerate(attr):
      if not isinstance(attr_item, dict):
        raise TypeError(
            f'{attr_type} {ix} of test specification {identifier} '
            f'must be an object, got {type(attr_item)}')
      if 'name' not in attr_item:
        raise TypeError(
            f'{attr_type} {ix} of test specification {identifier} '
            f'missing a name')
      if 'elements' not in attr_item:
        raise TypeError(
            f'{attr_type} {ix} of test specification {identifier} '
            f'missing a elements')
      if not isinstance(attr_item['elements'], list):
        raise TypeError(
            f'{attr_type} {ix} of test specification {identifier} '
            f'must be a list, got {type(attr_item["elements"])}')


def inject_test_tranforms(spec, test_spec, fix_failures):
  validate_test_spec(test_spec)
  scope = yaml_transform.LightweightScope(spec['transforms'])

  mocked_inputs_by_id = {
      scope.get_transform_id(mock_input['name']): mock_input

View on GitHub (pinned to 12126d8942)