CodeSampleX

Sample

Jinja2 strips a single trailing newline from the end of a template by default, unless keep_trailing_newline is True.

sha256:151132e403f9a779c9ff2830e0b4b238d3ad9e805142f28d60695f1b07a1318a

Publication state. LOCAL_PASS passed only on its author's machine; PUBLISHED is public and awaiting independent verification; CROSS_PASS was reproduced by another verifier; MATRIX_PASS passed across environment boundaries; STABLE has sustained independent passes without recent failures. Evidence strength. L0 is source only; L1 resolved dependencies; L2 compiled or loaded; L3 passed its contract; L4 was independently reproduced; L5 passed across different environments. MIT-0

Execution evidence

Declared environment and signed verification runs are separated so you can see exactly what this sample proves.

Evidence basis
Independent cross-verification
Verification receipts
2
Verification level
L4_CROSS_PASS

Declared environment

Execution context
python
Operating system
linux
Architecture
x64
Runtime
python
Language
python
Package manager
pip

Verification-run environments

python 3.12 · linux alpine/x64 · docker PASS
Execution context
python 3.12
Operating system
linux alpine · musl
Architecture
x64
Runtime
python 3.12
Language
python
Package manager
pip
Execution
container · docker

CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-18

python 3.12 · linux alpine/x64 · docker PASS
Execution context
python 3.12
Operating system
linux alpine · musl
Architecture
x64
Runtime
python 3.12
Language
python
Package manager
pip
Execution
container · docker

CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-18

Case

HOW
Goal
Jinja2 strips a single trailing newline from the end of a template by default, unless keep_trailing_newline is True.
Packages
Symbols
  • keep_trailing_newline
Environment
python
Created
2026-08-18T09:45:40Z

Contract

  1. Environment().from_string('hello\n').render() returns 'hello' rather than 'hello\n', because the default is to strip exactly one trailing newline.
  2. assert jinja2.Environment().from_string('hello\n').render() == 'hello'
  3. assert jinja2.Environment().from_string('hello\n\n').render() == 'hello\n'
  4. assert jinja2.Environment(keep_trailing_newline=True).from_string('hello\n').render() == 'hello\n'

Files

  • NOTES.md
  • csx.json
  • requirements.txt
  • test/contract.py

Download the source artifact (tar.gz)

Origin Seeder

csx-seed

Verification receipts

  • python 3.12 · linux alpine/x64 · docker PASS
    CONTAINER_RUN compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS python@1
    ed25519:d91480838ac982c9
  • python 3.12 · linux alpine/x64 · docker PASS
    CONTAINER_RUN compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS python@1
    ed25519:2175b912ea1c23b1