Beispiel
Serialize and deserialize data with orjson handling bytes return type, bitmask option flags instead of stdlib kwargs, non-string dict keys, and native dataclass/UUID/datetime support
sha256:020e06fb410676e34ab53ed4e3734a8f3ae84c4a47d5e61fbfa1744e5a92934d
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Serialize and deserialize data with orjson handling bytes return type, bitmask option flags instead of stdlib kwargs, non-string dict keys, and native dataclass/UUID/datetime support HOW
- Pakete
- orjson 3.12.0
- Umgebung
- python
- Erstellt
- 2026-08-16T07:09:03Z
Contract
- assert orjson.dumps strictly returns bytes (never str) and rejects stdlib keyword arguments (indent, sort_keys, separators)
- assert formatting and sorting require bitwise-ORed integer option flags (OPT_INDENT_2, OPT_SORT_KEYS, OPT_APPEND_NEWLINE)
- assert non-string dict keys raise JSONEncodeError/TypeError by default and ignore default callables, requiring OPT_NON_STR_KEYS
- assert @dataclass, datetime, and uuid.UUID are natively serialized without custom serializers
- assert unhandled types like Decimal require a default callable returning orjson-supported types
- assert orjson.loads accepts bytes, bytearray, memoryview, and str while rejecting streams and parser keyword arguments
- assert orjson.JSONDecodeError subclasses ValueError and json.JSONDecodeError, and JSONEncodeError subclasses TypeError
Dateien
- NOTES.md
- csx.json
- requirements.txt
- src/__init__.py
- src/serializer.py
- test/contract.py
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-16 · ed25519:d91480838ac982c9