diff options
author | Julien Palard <julien@palard.fr> | 2019-05-09 14:22:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-09 14:22:15 (GMT) |
commit | afd1e6d2f0f5aaf4030d13342809ec0915dedf81 (patch) | |
tree | 832da190993468bc973995f96ca60d580a08069c /Lib/test | |
parent | 88db8bd0648588c67eeab16d0bc72ec5c206e3ad (diff) | |
download | cpython-afd1e6d2f0f5aaf4030d13342809ec0915dedf81.zip cpython-afd1e6d2f0f5aaf4030d13342809ec0915dedf81.tar.gz cpython-afd1e6d2f0f5aaf4030d13342809ec0915dedf81.tar.bz2 |
bpo-36239: Skip comments in gettext infos (GH-12255)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_gettext.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py index 8c0250e..9d1a96b 100644 --- a/Lib/test/test_gettext.py +++ b/Lib/test/test_gettext.py @@ -684,6 +684,19 @@ class GNUTranslationParsingTest(GettextBaseTest): # If this runs cleanly, the bug is fixed. t = gettext.GNUTranslations(fp) + def test_ignore_comments_in_headers_issue36239(self): + """Checks that comments like: + + #-#-#-#-# messages.po (EdX Studio) #-#-#-#-# + + are ignored. + """ + with open(MOFILE, 'wb') as fp: + fp.write(base64.decodebytes(GNU_MO_DATA_ISSUE_17898)) + with open(MOFILE, 'rb') as fp: + t = gettext.GNUTranslations(fp) + self.assertEqual(t.info()["plural-forms"], "nplurals=2; plural=(n != 1);") + class UnicodeTranslationsTest(GettextBaseTest): def setUp(self): |