

def test_modelview_localization():

    def test_locale(locale):
        try:
            (app, db, admin) = setup()
            app.config['BABEL_DEFAULT_LOCALE'] = locale
            babel = Babel(app)
            (Model1, _) = create_models(db)
            view = CustomModelView(Model1, db.session, column_filters=['test1', 'bool_field', 'date_field', 'datetime_field', 'time_field'])
            admin.add_view(view)
            client = app.test_client()
            rv = client.get('/admin/model1/')
            eq_(rv.status_code, 200)
            rv = client.get('/admin/model1/new/')
            eq_(rv.status_code, 200)
        except:
            print('Error on the following locale:', locale)
            raise
    locales = ['en', 'cs', 'de', 'es', 'fa', 'fr', 'pt', 'ru', 'zh_CN', 'zh_TW']
    for locale in locales:
        test_locale(locale)

dataset/ETHPy150Open flask-admin/flask-admin/flask_admin/tests/sqla/test_basic.py test_modelview_localization/original