From 999735d825ee2f94701da29bcf819ad70ee03499 Mon Sep 17 00:00:00 2001 From: Ilya Sorochan Date: Wed, 7 Aug 2024 10:24:04 +0400 Subject: [PATCH] Fix list-translations() ordering in tests --- tests/test_gettext.py | 8 ++++---- tests/test_integration.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_gettext.py b/tests/test_gettext.py index e53d60f..4ee2ceb 100644 --- a/tests/test_gettext.py +++ b/tests/test_gettext.py @@ -91,11 +91,11 @@ def test_list_translations(): b = babel.Babel(app, default_locale="de_DE") with app.app_context(): - translations = b.list_translations() + translations = sorted(b.list_translations(), key=str) assert len(translations) == 3 assert str(translations[0]) == "de" - assert str(translations[1]) == "ja" - assert str(translations[2]) == "de_DE" + assert str(translations[1]) == "de_DE" + assert str(translations[2]) == "ja" def test_list_translations_default_locale_exists(): @@ -103,7 +103,7 @@ def test_list_translations_default_locale_exists(): b = babel.Babel(app, default_locale="de") with app.app_context(): - translations = b.list_translations() + translations = sorted(b.list_translations(), key=str) assert len(translations) == 2 assert str(translations[0]) == "de" assert str(translations[1]) == "ja" diff --git a/tests/test_integration.py b/tests/test_integration.py index 16a03fa..7af0ef8 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -38,13 +38,13 @@ def test_multiple_directories(): b.init_app(app) with app.test_request_context(): - translations = b.list_translations() + translations = sorted(b.list_translations(), key=str) assert len(translations) == 4 assert str(translations[0]) == "de" - assert str(translations[1]) == "ja" - assert str(translations[2]) == "de" - assert str(translations[3]) == "de_DE" + assert str(translations[1]) == "de" + assert str(translations[2]) == "de_DE" + assert str(translations[3]) == "ja" assert gettext("Hello %(name)s!", name="Peter") == "Hallo Peter!"