

def test_template_filters():
    template = "\n        Dollar: {{ 0.1 | dollar }}<br>\n        Sum Key: {{ data | sum_key('col') }}<br>\n        Max Key: {{ data | max_key('col') }}<br>\n        Average Key: {{ data | average_key('col') }}<br>\n    "
    data = [dict(col=0), dict(col=0.5), dict(col=0.5), dict(col=1)]
    with current_app.app_context():
        html = render_template_string(template, data=data)
    assert ('Dollar: $0.10<br>' in html)
    assert ('Sum Key: 2.0<br>' in html)
    assert ('Max Key: 1<br>' in html)
    assert ('Average Key: 0.5<br>' in html)

dataset/ETHPy150Open Robpol86/Flask-Large-Application-Example/tests/test_middleware.py test_template_filters/original