summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAndrew Kuchling <amk@amk.ca>2015-04-14 14:35:43 (GMT)
committerAndrew Kuchling <amk@amk.ca>2015-04-14 14:35:43 (GMT)
commit19ddaf6d40efd69d7c5292a24a5bd78b5166465a (patch)
tree381cd81153944d30c59f8547b5e87b1b9356a655 /Lib/test
parent467a546b5ea4ca4112f3cc4ae1f7c0c39a8ad0cf (diff)
parentb3c30d91143be72a05a02b9eb5f7b2e670450288 (diff)
downloadcpython-19ddaf6d40efd69d7c5292a24a5bd78b5166465a.zip
cpython-19ddaf6d40efd69d7c5292a24a5bd78b5166465a.tar.gz
cpython-19ddaf6d40efd69d7c5292a24a5bd78b5166465a.tar.bz2
Merge from 3.4
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_gettext.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_gettext.py b/Lib/test/test_gettext.py
index c7ceb3f..de610c7 100644
--- a/Lib/test/test_gettext.py
+++ b/Lib/test/test_gettext.py
@@ -134,6 +134,12 @@ class GettextBaseTest(unittest.TestCase):
del self.env
support.rmtree(os.path.split(LOCALEDIR)[0])
+GNU_MO_DATA_ISSUE_17898 = b'''\
+3hIElQAAAAABAAAAHAAAACQAAAAAAAAAAAAAAAAAAAAsAAAAggAAAC0AAAAAUGx1cmFsLUZvcm1z
+OiBucGx1cmFscz0yOyBwbHVyYWw9KG4gIT0gMSk7CiMtIy0jLSMtIyAgbWVzc2FnZXMucG8gKEVk
+WCBTdHVkaW8pICAjLSMtIy0jLSMKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PVVU
+Ri04CgA=
+'''
class GettextTestCase1(GettextBaseTest):
def setUp(self):
@@ -360,6 +366,14 @@ class PluralFormsTestCase(GettextBaseTest):
# Test for a dangerous expression
raises(ValueError, gettext.c2py, "os.chmod('/etc/passwd',0777)")
+class GNUTranslationParsingTest(GettextBaseTest):
+ def test_plural_form_error_issue17898(self):
+ with open(MOFILE, 'wb') as fp:
+ fp.write(base64.decodebytes(GNU_MO_DATA_ISSUE_17898))
+ with open(MOFILE, 'rb') as fp:
+ # If this runs cleanly, the bug is fixed.
+ t = gettext.GNUTranslations(fp)
+
class UnicodeTranslationsTest(GettextBaseTest):
def setUp(self):
@@ -535,3 +549,16 @@ msgstr ""
"Content-Transfer-Encoding: quoted-printable\n"
"Generated-By: pygettext.py 1.3\n"
'''
+
+#
+# messages.po, used for bug 17898
+#
+
+'''
+# test file for http://bugs.python.org/issue17898
+msgid ""
+msgstr ""
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"#-#-#-#-# messages.po (EdX Studio) #-#-#-#-#\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+'''