Skip to content

Commit

Permalink
Fix tests for Python 3.11+
Browse files Browse the repository at this point in the history
After python/cpython#19869 PR merged gettext() can lookup plural() which is not set when constructor argument (file handler) is unspecified
  • Loading branch information
m-aciek committed Feb 16, 2024
1 parent 51cd42e commit e397ae7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@


class AttributiveTranslationsTest(TestCase):
def setUp(self):
empty_mo_file.seek(0)

def test_value_returned_is_userstring(self):
value_returned = AttributiveTranslations(empty_mo_file).gettext('foo')
self.assertIsInstance(value_returned, UserString)

def test_is_attributive(self):
t = AttributiveTranslations()
t = AttributiveTranslations(empty_mo_file)
t._catalog = {'attribute\x04foo': 'bar'}

foo = t.gettext('foo')
self.assertEqual('bar', foo.attribute)

def test_fallbacks(self):
t = AttributiveTranslations()
t = AttributiveTranslations(empty_mo_file)
t._catalog = {'user': 'użytkownik'}

message = t.gettext('user')
Expand Down

0 comments on commit e397ae7

Please sign in to comment.