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

Method test_extract_trimmed

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

Source from the content-addressed store, hash-verified

401 ]
402
403 def test_extract_trimmed(self):
404 from jinja2.ext import babel_extract
405
406 source = BytesIO(
407 b"""
408 {{ gettext(' Hello \n World') }}
409 {% trans trimmed %} Hello \n World{% endtrans %}
410 {% trans trimmed %}{{ users }} \n user
411 {%- pluralize %}{{ users }} \n users{% endtrans %}
412 """
413 )
414 assert list(babel_extract(source, ("gettext", "ngettext", "_"), [], {})) == [
415 (2, "gettext", " Hello \n World", []),
416 (4, "gettext", "Hello World", []),
417 (6, "ngettext", ("%(users)s user", "%(users)s users", None), []),
418 ]
419
420 def test_extract_trimmed_option(self):
421 from jinja2.ext import babel_extract

Callers

nothing calls this directly

Calls 1

babel_extractFunction · 0.90

Tested by

no test coverage detected