danhper / python-i18n

Easy to use i18n library for Python
https://pypi.python.org/pypi/python-i18n
MIT License
228 stars 45 forks source link

Translation tests failing #36

Open jayvdb opened 2 years ago

jayvdb commented 2 years ago

These tests are failing for me on Python 3.8 & 3.10. They used to pass iirc, so that only cause could be Python version or using latest PyYAML.

...
i18n/tests/translation_tests.py FFF..F.FFFF.....                                                                                                                                                                                      [100%]

================================================================================================================= FAILURES ==================================================================================================================
_______________________________________________________________________________________________ TestTranslationFormat.test_bad_pluralization ________________________________________________________________________________________________

self = <i18n.tests.translation_tests.TestTranslationFormat testMethod=test_bad_pluralization>

    def test_bad_pluralization(self):
        config.set('error_on_missing_plural', False)
        self.assertEqual(t('foo.normal_key', count=5), 'normal_value')
        config.set('error_on_missing_plural', True)
>       with self.assertRaises(KeyError):
E       AssertionError: KeyError not raised

i18n/tests/translation_tests.py:102: AssertionError
_______________________________________________________________________________________________ TestTranslationFormat.test_basic_placeholder ________________________________________________________________________________________________

self = <i18n.tests.translation_tests.TestTranslationFormat testMethod=test_basic_placeholder>

    def test_basic_placeholder(self):
>       self.assertEqual(t('foo.hi', name='Bob'), 'Hello Bob !')
E       AssertionError: 'foo.hi' != 'Hello Bob !'
E       - foo.hi
E       + Hello Bob !

i18n/tests/translation_tests.py:77: AssertionError
______________________________________________________________________________________________ TestTranslationFormat.test_basic_pluralization _______________________________________________________________________________________________

self = <i18n.tests.translation_tests.TestTranslationFormat testMethod=test_basic_pluralization>

    def test_basic_pluralization(self):
>       self.assertEqual(t('foo.basic_plural', count=0), '0 elems')
E       AssertionError: 'foo.basic_plural' != '0 elems'
E       - foo.basic_plural
E       + 0 elems

i18n/tests/translation_tests.py:88: AssertionError
____________________________________________________________________________________________________ TestTranslationFormat.test_fallback ____________________________________________________________________________________________________

self = <i18n.tests.translation_tests.TestTranslationFormat testMethod=test_fallback>

    def test_fallback(self):
        config.set('fallback', 'fr')
>       self.assertEqual(t('foo.hello', name='Bob'), 'Salut Bob !')
E       AssertionError: 'foo.hello' != 'Salut Bob !'
E       - foo.hello
E       + Salut Bob !

i18n/tests/translation_tests.py:70: AssertionError
_______________________________________________________________________________________________ TestTranslationFormat.test_full_pluralization _______________________________________________________________________________________________

self = <i18n.tests.translation_tests.TestTranslationFormat testMethod=test_full_pluralization>

    def test_full_pluralization(self):
>       self.assertEqual(t('foo.plural', count=0), 'no mail')
E       AssertionError: 'foo.plural' != 'no mail'
E       - foo.plural
E       + no mail

i18n/tests/translation_tests.py:93: AssertionError
_________________________________________________________________________________________________ TestTranslationFormat.test_locale_change __________________________________________________________________________________________________

self = <i18n.tests.translation_tests.TestTranslationFormat testMethod=test_locale_change>

    def test_locale_change(self):
        config.set('locale', 'fr')
>       self.assertEqual(t('foo.hello', name='Bob'), 'Salut Bob !')
E       AssertionError: 'foo.hello' != 'Salut Bob !'
E       - foo.hello
E       + Salut Bob !

i18n/tests/translation_tests.py:66: AssertionError
_______________________________________________________________________________________________ TestTranslationFormat.test_missing_placehoder _______________________________________________________________________________________________

self = <i18n.tests.translation_tests.TestTranslationFormat testMethod=test_missing_placehoder>

    def test_missing_placehoder(self):
>       self.assertEqual(t('foo.hi'), 'Hello %{name} !')
E       AssertionError: 'foo.hi' != 'Hello %{name} !'
E       - foo.hi
E       + Hello %{name} !

i18n/tests/translation_tests.py:80: AssertionError
___________________________________________________________________________________________ TestTranslationFormat.test_missing_placeholder_error ____________________________________________________________________________________________

self = <i18n.tests.translation_tests.TestTranslationFormat testMethod=test_missing_placeholder_error>

    def test_missing_placeholder_error(self):
        config.set('error_on_missing_placeholder', True)
>       with self.assertRaises(KeyError):
E       AssertionError: KeyError not raised