File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -411,15 +411,15 @@ def _parse(self, fp):
411411 self ._charset = v .split ('charset=' )[1 ]
412412 except IndexError :
413413 raise ValueError (
414- f"invalid content-type syntax in ' { filename } ': ' { v } '. Expected 'charset='. "
414+ f"expected 'charset=' in Content-Type metadata in { filename } , got { v !r } "
415415 ) from None
416416 elif k == 'plural-forms' :
417417 v = v .split (';' )
418418 try :
419419 plural = v [1 ].split ('plural=' )[1 ]
420420 except IndexError :
421421 raise ValueError (
422- f"invalid plural forms syntax in ' { filename } ': ' { v } '. Expected ';' and 'plural='. "
422+ f"expected ';' and ' plural=' in Plural-Forms metadata in { filename } , got { v !r } "
423423 ) from None
424424 self .plural = c2py (plural )
425425 # Note: we unconditionally convert both msgids and msgstrs to
Original file line number Diff line number Diff line change @@ -675,7 +675,10 @@ def test_raise_descriptive_error_for_incorrect_content_type(self):
675675 b'\x00 \x00 \x00 \x00 \x00 \x00 8\x00 \x00 \x00 (\x00 \x00 \x00 9\x00 \x00 \x00 \x01 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 '
676676 b'\x00 \x00 \x00 \x00 Content-Type: text/plain; charste=UTF-8\n \x00 '
677677 )
678- with self .assertRaisesRegex (ValueError , "invalid content-type syntax" ):
678+ with self .assertRaisesRegex (
679+ ValueError ,
680+ "expected 'charset=' in Content-Type metadata in gettext.mo, got 'text/plain; charste=UTF-8'"
681+ ):
679682 with open (MOFILE , 'rb' ) as fp :
680683 gettext .GNUTranslations (fp )
681684
@@ -691,7 +694,9 @@ def test_raise_descriptive_error_for_incorrect_plural_forms(self):
691694 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 '
692695 b'\x00 \x00 \x00 \x00 Content-Type: text/plain; charset=UTF-8\n Plural-Forms: \n \x00 '
693696 )
694- with self .assertRaisesRegex (ValueError , "invalid plural forms syntax" ):
697+ with self .assertRaisesRegex (
698+ ValueError , "expected ';' and 'plural=' in Plural-Forms metadata in gettext.mo, got ''"
699+ ):
695700 with open (MOFILE , 'rb' ) as fp :
696701 gettext .GNUTranslations (fp )
697702
You can’t perform that action at this time.
0 commit comments