def dump(self):
        """Serialize a test case to a string."""
        result = list(self.output_lines())
        if self.locked:
            result.append('# locked')
            if self.choices:
                for choice in self.choices:
                    result.append('# choice: ' + choice)
        if self.explanation:
            result.append('# explanation: ' + self.explanation)
        return '\n'.join(result)
Serialize a test case to a string.