Test your e-invoice generator, rule by rule
Example invoices checked against the official rules: each invalid one fails the rules its manifest names, and nothing else, so your tests know exactly what must be caught. Free to use for anything: the examples are in the public domain (CC0).
Targets
A target is the set of rules the examples follow. Pick the one your invoices must pass.
| Target | Rules | For |
|---|---|---|
en16931 |
The European standard EN 16931, and the Factur-X / ZUGFeRD profile rules | An e-invoice that follows the European standard, in any country: the French, German (XRechnung) and Peppol rules all build on it |
fr |
The same, plus the French e-invoicing reform's rules (BR-FR) | An invoice from a seller in France |
Next: Germany (XRechnung), then Peppol, and UBL alongside CII.
Download the examples
Each target has its folder, examples/en16931/ and examples/fr/, which holds, as XML (CII) and as a Factur-X PDF
(in Germany, ZUGFeRD):
valid.xml,valid.pdf: an invoice that passes every rule of its target. Inen16931, a domestic invoice between two companies in Germany, with no national field; infr, a French invoice;invalid/<rule>.xml,invalid/<rule>.pdf: the same invoice with one thing wrong, for exampleinvalid/BR-CO-15.xml(the total with VAT is not the total without VAT plus the VAT) or, infr,invalid/BR-FR-10.xml(the seller's SIREN is missing);fixed/<rule>.xml,fixed/<rule>.pdf: for an invalid example that first adds something to the invoice (an allowance, a charge, a line, a party, a period…), the same invoice without the mistake, which passes every rule;manifest.json: for each example, the rules it fails, in English and French, and the rule versions.
| Rules checked | Version | Targets |
|---|---|---|
| EN 16931 (CII) | 1.3.17 | en16931, fr |
| Factur-X, EN 16931 profile | 1.09.2 | en16931, fr |
| BR-FR (French e-invoicing reform), FNFE-MPE France_RFE | 1.4.0.04 | fr |
EXTENDED-CTC-FR (France_RFE), with the CII D22B schema: only for the examples in that profile (BR-CO-25) |
1.4.0.04 | fr |
Most examples use the Factur-X EN 16931 profile. An example whose rule exists only in a richer profile uses it and says so: BR-CO-25 is an EXTENDED-CTC-FR invoice, one of the profiles the French reform admits, since the EN 16931 validation files no longer carry that rule (release notes of 1.3.16).
Valid means:
- no fatal error from the rule sets of its target;
- valid against the Factur-X 1.09.2 EN 16931 schema.
No BR-FR rule fires on an en16931 example: those rules apply to a seller in France.
Invalid means the example fails exactly the rules its manifest entry lists, and nothing else.
- Most fail one rule.
- A few fail two or more, because the official rules overlap (for example EN 16931
BR-CO-21andBR-33, which both want a reason for a document level allowance). - Every invalid example stays schema-valid: only a business rule is broken.
Coverage: COVERAGE.md lists, for each target, every rule with its invalid example and what is wrong in it, and says why a rule has none.
About the PDFs: each one has a readable page drawn from its own XML, marked SPECIMEN, and carries that XML as factur-x.xml. The pages are in English in en16931, in French in fr. On an invalid example, the page names the rule it fails and what is wrong, and shows the mistake in red: the values it draws that differ from the invoice it is compared with (valid.pdf, or fixed/<rule>.pdf when there is one); when the mistake sits in data the page does not draw (a supporting document, a period, the payee), in the electronic data only, a box under the totals says so, names that file and lists what differs: each element with its business term (BT-…), its value, its place in the XML and its value in that file. annotated.pdf is the valid invoice with each value's EN 16931 business term number (BT-…), for learning to read an e-invoice. The PDFs are not PDF/A-3: they are for testing XML extraction and the XML rules, not PDF/A-3 validation.
Use them in a test suite
The same examples also ship as a Python package, so a test suite can pin a version instead of copying files:
uvx invoice-examples generate --target en16931 --out examples/ # writes exactly the files of examples/en16931/
uvx invoice-examples generate --target fr --out examples/ # and those of examples/fr/
The same version always writes the same bytes. Each release also ships its wheel and sdist on GitHub Releases.
How the examples are checked
The test suite builds every example and runs the official artefacts on it, pinned and downloaded once:
- the EN 16931 Schematron;
- the Factur-X profile rules;
- the BR-FR Schematron, for target
fr(run with Saxon); - the Factur-X schema.
It fails if:
- a valid example fails any rule of its target;
- an invalid example fails a rule it does not declare, or misses one it does;
- the committed
examples/folder differs from what the code generates.
The checks use the official files only, not a validator of ours, so the examples are an independent reference. France_RFE's AFNOR documents are never downloaded.
uv sync && uv run pytest
uv run python scripts/coverage.py # rewrites COVERAGE.md
Licences
- The examples (
examples/): CC0-1.0. - The code: MIT.
- The fonts drawn in the PDFs (
src/invoice_examples/fonts/): IBM Plex, SIL Open Font License 1.1. - The official rules used by the tests keep their own licences (EUPL-1.2 for EN 16931; Apache-2.0 for the France_RFE repository, whose Schematron file headers say EUPL) and are not part of this repository.
Metadata
Release files for invoice-examples 0.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| invoice_examples-0.9.0.tar.gz | 26.3 MB | With provenance | Details for invoice_examples-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| invoice_examples-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for invoice_examples-0.9.0-py3-none-any.whl |
Total release size: 26.6 MB
Release files / invoice_examples-0.9.0.tar.gz
| Download URL | invoice_examples-0.9.0.tar.gz |
|---|---|
| Size | 26.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a89153bf7f68bb6c703be95fb3326d53667dfef2539faa39b811c7c82634d99
|
|
BLAKE2b-256 checksum How to use checksums |
33be18111d04f2a6877ed68d143bedc7a456fa6c4e95fcea6aef1383438120a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / invoice_examples-0.9.0-py3-none-any.whl
| Download URL | invoice_examples-0.9.0-py3-none-any.whl |
|---|---|
| Size | 318.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bec98967bbb0b4f0fb78356eeca394fcb806cd2c9e75b010419901a2004d710
|
|
BLAKE2b-256 checksum How to use checksums |
ef18cadd3fd3986a3443ce13deebf2838e0dec4b18bce3b12ee0bc00d8540926
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for invoice-examples 0.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for invoice_examples-0.9.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.