]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Add test to cover `force_text` fully small-cleanup 1170/head
authorAarni Koskela <akx@iki.fi>
Tue, 14 Jan 2025 07:52:14 +0000 (09:52 +0200)
committerAarni Koskela <akx@iki.fi>
Tue, 14 Jan 2025 07:52:31 +0000 (09:52 +0200)
tests/messages/test_catalog.py

index 244d832ab6e31f0a1ffe7b69606f9deff54e27f8..16d36756b02b817e3d1e7b402aa65a3b99aaeb59 100644 (file)
@@ -414,6 +414,17 @@ def test_catalog_mime_headers_set_locale():
     ]
 
 
+def test_catalog_mime_headers_type_coercion():
+    """
+    Test that mime headers' keys and values are coerced to strings
+    """
+    cat = catalog.Catalog(locale='de_DE', project='Foobar', version='1.0')
+    # This is a strange interface in that it doesn't actually overwrite all
+    # of the MIME headers, but just sets the ones that are passed in (and known).
+    cat.mime_headers = {b'REPORT-MSGID-BUGS-TO': 8}.items()
+    assert dict(cat.mime_headers)['Report-Msgid-Bugs-To'] == '8'
+
+
 def test_catalog_num_plurals():
     assert catalog.Catalog(locale='en').num_plurals == 2
     assert catalog.Catalog(locale='ga').num_plurals == 5