diff options
author | Aarni Koskela <akx@iki.fi> | 2022-05-10 15:36:47 +0300 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2022-05-10 15:00:24 +0200 |
commit | 40059883cc260af890bcc81a1a21c0f84781857f (patch) | |
tree | 605a7c0ac23b1f593adfe46680c0a37a1437ad12 /tests | |
parent | 5e37cea3e41e5f6915468147a0e250ba3d270ad8 (diff) | |
download | babel-40059883cc260af890bcc81a1a21c0f84781857f.tar.gz |
Use email.Message for pofile header parsing
cgi.parse_header is due to be deprecated
Fixes #873
Diffstat (limited to 'tests')
-rw-r--r-- | tests/messages/test_pofile.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/messages/test_pofile.py b/tests/messages/test_pofile.py index 73a7b0e..99e59ba 100644 --- a/tests/messages/test_pofile.py +++ b/tests/messages/test_pofile.py @@ -69,6 +69,17 @@ msgstr "bär"'''.encode('iso-8859-1')) catalog = pofile.read_po(buf, locale='de_DE') assert catalog.get('foo').string == 'bär' + def test_encoding_header_read(self): + buf = BytesIO(b'msgid ""\nmsgstr ""\n"Content-Type: text/plain; charset=mac_roman\\n"\n') + catalog = pofile.read_po(buf, locale='xx_XX') + assert catalog.charset == 'mac_roman' + + def test_plural_forms_header_parsed(self): + buf = BytesIO(b'msgid ""\nmsgstr ""\n"Plural-Forms: nplurals=42; plural=(n % 11);\\n"\n') + catalog = pofile.read_po(buf, locale='xx_XX') + assert catalog.plural_expr == '(n % 11)' + assert catalog.num_plurals == 42 + def test_read_multiline(self): buf = StringIO(r'''msgid "" "Here's some text that\n" |