File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -664,6 +664,21 @@ def test_ignore_comments_in_headers_issue36239(self):
664664 t = gettext .GNUTranslations (fp )
665665 self .assertEqual (t .info ()["plural-forms" ], "nplurals=2; plural=(n != 1);" )
666666
667+ def test_raise_descriptive_error_for_incorrect_content_type (self ):
668+ with open (MOFILE , 'wb' ) as fp :
669+ # below is msgfmt run on such a PO file:
670+ # msgid ""
671+ # msgstr ""
672+ # "Content-Type: text/plain; charste=UTF-8\n"
673+ fp .write (
674+ b'\xde \x12 \x04 \x95 \x00 \x00 \x00 \x00 \x01 \x00 \x00 \x00 \x1c \x00 \x00 \x00 $\x00 \x00 \x00 \x03 \x00 \x00 \x00 ,\x00 '
675+ b'\x00 \x00 \x00 \x00 \x00 \x00 8\x00 \x00 \x00 7\x00 \x00 \x00 9\x00 \x00 \x00 \x01 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 '
676+ b'\x00 \x00 \x00 \x00 Content-Type: text/plain; charste=UTF-8\n \x00 '
677+ )
678+ with self .assertRaisesRegex (ValueError , "invalid content-type syntax" ):
679+ with open (MOFILE , 'rb' ) as fp :
680+ gettext .GNUTranslations (fp )
681+
667682 def test_raise_descriptive_error_for_incorrect_plural_forms (self ):
668683 with open (MOFILE , 'wb' ) as fp :
669684 # below is msgfmt run on such a PO file:
You can’t perform that action at this time.
0 commit comments