Tests
Test: negative-float
Template
{{ -3.14|abs }}
Output Django (error) v1.10.1
Invalid filter: 'abs'
Output Jinja2 v2.8.0
3.14
Output Liquid v3.0.6
-3.14
Output Nunjucks v2.5.0
3.14
Output Swig (error) v1.4.2
Invalid filter "abs".
Output Twig v1.24.2
-3.14
Output Twigjs v0.9.5
3.14
Test: negative-integer
Template
{{ -3|abs }}
Output Django (error) v1.10.1
Invalid filter: 'abs'
Output Jinja2 v2.8.0
3
Output Liquid v3.0.6
-3
Output Nunjucks v2.5.0
3
Output Swig (error) v1.4.2
Invalid filter "abs".
Output Twig v1.24.2
-3
Output Twigjs v0.9.5
3
Test: positive-float
Template
{{ 3.14|abs }}
Output Django (error) v1.10.1
Invalid filter: 'abs'
Output Jinja2 v2.8.0
3.14
Output Liquid v3.0.6
3.14
Output Nunjucks v2.5.0
3.14
Output Swig (error) v1.4.2
Invalid filter "abs".
Output Twig v1.24.2
3.14
Output Twigjs v0.9.5
3.14
Test: positive-integer
Template
{{ 3|abs }}
Output Django (error) v1.10.1
Invalid filter: 'abs'
Output Jinja2 v2.8.0
3
Output Liquid v3.0.6
3
Output Nunjucks v2.5.0
3
Output Swig (error) v1.4.2
Invalid filter "abs".
Output Twig v1.24.2
3
Output Twigjs v0.9.5
3
Test: string
Template
{{ '-3.14'|abs }}
Output Django (error) v1.10.1
Invalid filter: 'abs'
Output Jinja2 (error) v2.8.0
bad operand type for abs(): 'str'
Output Liquid v3.0.6
-3.14
Output Nunjucks v2.5.0
3.14
Output Swig (error) v1.4.2
Invalid filter "abs".
Output Twig v1.24.2
3.14
Output Twigjs v0.9.5
3.14
Test: variable
Template
{{ x|abs }}
Data
{
"x": -3
}
Output Django (error) v1.10.1
Invalid filter: 'abs'
Output Jinja2 v2.8.0
3
Output Liquid v3.0.6
-3
Output Nunjucks v2.5.0
3
Output Swig (error) v1.4.2
Invalid filter "abs".
Output Twig v1.24.2
3
Output Twigjs v0.9.5
3
Test: zero
Template
{{ 0|abs }}
Output Django (error) v1.10.1
Invalid filter: 'abs'
Output Jinja2 v2.8.0
0
Output Liquid v3.0.6
0
Output Nunjucks v2.5.0
0
Output Swig (error) v1.4.2
Invalid filter "abs".
Output Twig v1.24.2
0
Output Twigjs v0.9.5
0