summaryrefslogtreecommitdiffstats
path: root/lang/python/python-flask-babel/test.sh
blob: 48877f43277632236ecadc1952f8cff2a9ca01ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

[ "$1" = python3-flask-babel ] || exit 0

python3 - <<'EOF'
from flask import Flask
from flask_babel import Babel, gettext, lazy_gettext

app = Flask(__name__)
babel = Babel(app)

with app.app_context():
    result = gettext("Hello")
    assert isinstance(result, str), "gettext should return a string"

lazy = lazy_gettext("World")
assert str(lazy) == "World", f"lazy_gettext failed: {lazy!r}"

print("python3-flask-babel OK")
EOF