'Template comment tags on the same line of other constructs (#19552)'

def test_template_comments(self):

    os.chdir(self.test_dir)
    with warnings.catch_warnings(record=True) as ws:
        warnings.simplefilter(u'always')
        management.call_command(u'makemessages', locale=[LOCALE], extensions=[u'thtml'], verbosity=0)
        self.assertEqual(len(ws), 3)
        for w in ws:
            self.assertTrue(issubclass(w.category, TranslatorCommentWarning))
        six.assertRegex(self, str(ws[0].message), u"The    translator-targeted    comment    'Translators:    ignored    i18n    comment    #1'    \\(file    templates[/\\\\]comments.thtml,    line    4\\)    was    ignored,    because    it    wasn't    the    last    item    on    the    line\\.")
        six.assertRegex(self, str(ws[1].message), u"The    translator-targeted    comment    'Translators:    ignored    i18n    comment    #3'    \\(file    templates[/\\\\]comments.thtml,    line    6\\)    was    ignored,    because    it    wasn't    the    last    item    on    the    line\\.")
        six.assertRegex(self, str(ws[2].message), u"The    translator-targeted    comment    'Translators:    ignored    i18n    comment    #4'    \\(file    templates[/\\\\]comments.thtml,    line    8\\)    was    ignored,    because    it    wasn't    the    last    item    on    the    line\\.")
    self.assertTrue(os.path.exists(self.PO_FILE))
    with open(self.PO_FILE, u'r') as fp:
        po_contents = force_text(fp.read())
        self.assertMsgId(u'Translatable    literal    #9a', po_contents)
        self.assertFalse((u'ignored    comment    #1' in po_contents))
        self.assertFalse((u'Translators:    ignored    i18n    comment    #1' in po_contents))
        self.assertMsgId(u'Translatable    literal    #9b', po_contents)
        self.assertFalse((u'ignored    i18n    comment    #2' in po_contents))
        self.assertFalse((u'ignored    comment    #2' in po_contents))
        self.assertMsgId(u'Translatable    literal    #9c', po_contents)
        self.assertFalse((u'ignored    comment    #3' in po_contents))
        self.assertFalse((u'ignored    i18n    comment    #3' in po_contents))
        self.assertMsgId(u'Translatable    literal    #9d', po_contents)
        self.assertFalse((u'ignored    comment    #4' in po_contents))
        self.assertMsgId(u'Translatable    literal    #9e', po_contents)
        self.assertFalse((u'ignored    comment    #5' in po_contents))
        self.assertFalse((u'ignored    i18n    comment    #4' in po_contents))
        self.assertMsgId(u'Translatable    literal    #9f', po_contents)
        self.assertTrue((u'#.    Translators:    valid    i18n    comment    #5' in po_contents))
        self.assertMsgId(u'Translatable    literal    #9g', po_contents)
        self.assertTrue((u'#.    Translators:    valid    i18n    comment    #6' in po_contents))
        self.assertMsgId(u'Translatable    literal    #9h', po_contents)
        self.assertTrue((u'#.    Translators:    valid    i18n    comment    #7' in po_contents))
        self.assertMsgId(u'Translatable    literal    #9i', po_contents)
        six.assertRegex(self, po_contents, u'#\\..+Translators:    valid    i18n    comment    #8')
        six.assertRegex(self, po_contents, u'#\\..+Translators:    valid    i18n    comment    #9')
        self.assertMsgId(u'Translatable    literal    #9j', po_contents)
