def testDocComments(self):
    def TryDocComment(language, input_text, expected):
      context = self._GetContext()
      lang_node = template_helpers.LanguageNode(language)
      lang_node.render(context)
      context['_LINE_WIDTH'] = 50  # to make expected easier to read
      doc_comment_node = template_helpers.DocCommentNode(
          text=input_text, comment_type='doc')
      self.assertEquals(expected, doc_comment_node.render(context))

    alphabet = 'abcdefghijklmnopqrstuvwxyz'

    # single line java and php
    value = '%s' % alphabet
    expected = '/** %s */' % alphabet
    TryDocComment('java', value, expected)
    TryDocComment('php', value, expected)

    # single line csharp and cpp
    value = 'Hello, World!'
    TryDocComment('cpp', value, '/** %s */' % value)
    TryDocComment('csharp', value, '/// <summary>%s</summary>' % value)

    # single line but with '\n' in it
    value = '123\n456'
    expected_expansion = '123 456'
    # NOTE(user): 20130111
    # Java and PHP have their own special methods for handling comments.
    # I think this case is wrong, but am not addressing it at this time
    # since it is still syntactically correct.
    TryDocComment('java', value, '/**\n * %s\n */' % expected_expansion)
    TryDocComment('php', value, '/**\n * %s\n */' % expected_expansion)
    TryDocComment('cpp', value, '/**\n * %s\n */' % expected_expansion)
    TryDocComment('csharp', value,
                  '/// <summary>%s</summary>' % expected_expansion)

    # multi line java and php
    value = '%s %s %s' % (alphabet, alphabet, alphabet)
    expected = '/**\n * %s\n * %s\n * %s\n */' % (alphabet, alphabet, alphabet)
    TryDocComment('java', value, expected)
    TryDocComment('php', value, expected)

    # single line csharp and c++
    value = alphabet
    TryDocComment('csharp', value, '/// <summary>%s</summary>' % value)
    TryDocComment('cpp', value, '/** %s */' % value)

    # multi line csharp
    value = '%s %s %s' % (alphabet, alphabet, alphabet)
    expected_expansion = '%s\n/// %s\n/// %s' % (alphabet, alphabet, alphabet)
    TryDocComment('csharp', value,
                  '/// <summary>%s</summary>' % expected_expansion)

    expected_expansion = '%s\n * %s\n * %s' % (alphabet, alphabet, alphabet)
    TryDocComment('cpp', value, '/**\n * %s\n */' % expected_expansion)
dataset/ETHPy150Open google/apis-client-generator/src/googleapis/codegen/template_helpers_test.py/TemplateHelpersTest.testDocComments/original