Skip to content

Commit

Permalink
Fix list-translations() ordering in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
k0tran committed Aug 7, 2024
1 parent 869715c commit 999735d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/test_gettext.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ 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():
app = flask.Flask(__name__)
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"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!"

Expand Down

0 comments on commit 999735d

Please sign in to comment.