MCPcopy
hub / github.com/pallets/jinja / test_extract_trimmed_option

Method test_extract_trimmed_option

tests/test_ext.py:420–436  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

418 ]
419
420 def test_extract_trimmed_option(self):
421 from jinja2.ext import babel_extract
422
423 source = BytesIO(
424 b"""
425 {{ gettext(' Hello \n World') }}
426 {% trans %} Hello \n World{% endtrans %}
427 {% trans %}{{ users }} \n user
428 {%- pluralize %}{{ users }} \n users{% endtrans %}
429 """
430 )
431 opts = {"trimmed": "true"}
432 assert list(babel_extract(source, ("gettext", "ngettext", "_"), [], opts)) == [
433 (2, "gettext", " Hello \n World", []),
434 (4, "gettext", "Hello World", []),
435 (6, "ngettext", ("%(users)s user", "%(users)s users", None), []),
436 ]
437
438 def test_comment_extract(self):
439 from jinja2.ext import babel_extract

Callers

nothing calls this directly

Calls 1

babel_extractFunction · 0.90

Tested by

no test coverage detected