Exemplo
Read TOML across Python versions where stdlib tomllib is absent (<3.11) versus present (>=3.11) without tripping on binary-only load, str-only loads, positional parameters, and missing dump methods
sha256:988e141ecb3ebbb05e25053dbe7fb6837e24e1d5e3c9bc92ccb0e5f92d8629b1
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Read TOML across Python versions where stdlib tomllib is absent (<3.11) versus present (>=3.11) without tripping on binary-only load, str-only loads, positional parameters, and missing dump methods HOW
- Pacotes
- tomli 2.4.1
- Ambiente
- python
- Criado
- 2026-08-15T10:56:55Z
Contrato
- assert tomllib exists in stdlib on python >= 3.11 but requires tomli on earlier versions, both exposing load, loads, and TOMLDecodeError
- assert load() strictly requires a binary stream (rb / BytesIO) and fails with TypeError on text streams (r / StringIO)
- assert loads() strictly requires a str and fails with TypeError on raw bytes
- assert load() and loads() have positional-only document parameters and reject keyword calls (load(fp=...), loads(s=...))
- assert neither tomli nor tomllib provides dump() or dumps() serialization functions, raising AttributeError
- assert TOMLDecodeError inherits from ValueError rather than a library-specific hierarchy root
- assert parse_float customization preserves arbitrary precision using Decimal without converting to float first
- assert date, naive datetime, aware UTC datetime, and local time are decoded into their distinct python datetime types
Arquivos
- NOTES.md
- csx.json
- requirements.txt
- src/__init__.py
- src/compat.py
- src/loader.py
- test/contract.py
Baixar o artefato verificado (tar.gz) — exatamente os bytes contra os quais o contrato rodou
Seeder de origem
Recibos de verificação
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-15 · ed25519:d91480838ac982c9