def _add_example_enumerated_subtypes_helper(self, example):
if len(example.fields) != <NUM_LIT:1>:<EOL><INDENT>raise InvalidSpec(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>', example.lineno, example.path)<EOL><DEDENT>example_field = list(example.fields.values())[<NUM_LIT:0>]<EOL>tag = example_field.name<EOL>val = example_field.value<EOL>if not isinstance(val, AstExampleRef):<EOL><INDENT>raise InvalidSpec(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>example_field.lineno, example_field.path)<EOL><DEDENT>for subtype_field in self.get_enumerated_subtypes():<EOL><INDENT>if subtype_field.name == tag:<EOL><INDENT>self._raw_examples[example.label] = example<EOL>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise InvalidSpec(<EOL>"<STR_LIT>" % tag,<EOL>example_field.lineno, example_field.path)<EOL><DEDENT>
Validates examples for structs with enumerated subtypes.