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

Method test_extract_context

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

Source from the content-addressed store, hash-verified

456 ]
457
458 def test_extract_context(self):
459 from jinja2.ext import babel_extract
460
461 source = BytesIO(
462 b"""
463 {{ pgettext("babel", "Hello World") }}
464 {{ npgettext("babel", "%(users)s user", "%(users)s users", users) }}
465 """
466 )
467 assert list(babel_extract(source, ("pgettext", "npgettext", "_"), [], {})) == [
468 (2, "pgettext", ("babel", "Hello World"), []),
469 (3, "npgettext", ("babel", "%(users)s user", "%(users)s users", None), []),
470 ]
471
472 def test_nested_trans_error(self):
473 s = "{% trans %}foo{% trans %}{% endtrans %}"

Callers

nothing calls this directly

Calls 1

babel_extractFunction · 0.90

Tested by

no test coverage detected