Skip to content

Commit

Permalink
Ensure locale change worked
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-easterbrook committed Dec 27, 2023
1 parent b31d9df commit 8f74eeb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ def test_localisation(self):
str_en = 'Failed to read input data'
str_de = 'Die Eingabedaten konnten nicht gelesen werden.'
old_locale = locale.setlocale(locale.LC_ALL, None)
# clear current locale
locale.setlocale(locale.LC_ALL, 'C')
self.assertEqual(exiv2.exvGettext(str_en), str_en)
# set German locale
for name in ('de_DE.utf8', 'de_DE.UTF-8', 'de_DE', 'German'):
try:
locale.setlocale(locale.LC_ALL, name)
Expand All @@ -123,6 +126,8 @@ def test_localisation(self):
else:
self.skipTest("failed to set locale")
return
if locale.getlocale() == (None, None):
self.skipTest("set locale had no effect")
self.assertEqual(exiv2.exvGettext(str_en), str_de)
locale.setlocale(locale.LC_ALL, old_locale)

Expand Down

0 comments on commit 8f74eeb

Please sign in to comment.