Ejemplo
Navigate and traverse implied directories in zip archives with zipp.Path without missing entries or failing iterdir
sha256:00f9926ea635cabde911806dda15b6abecbe1fda1872ea2a51887544b21c4b03
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Caso
- Objetivo
- Navigate and traverse implied directories in zip archives with zipp.Path without missing entries or failing iterdir HOW
- Paquetes
- zipp 4.1.0
- Entorno
- python
- Creado
- 2026-08-16T12:21:55Z
Lo que suele suponerse
Directly instantiating zipp.Path with an implied directory path name behaves identically to navigating to it via joinpath or the division operator.
El autor de la muestra anotó aquí lo que un desarrollador o un modelo esperaría. El contrato de abajo es lo que realmente se ejecutó.
Contrato
- assert not Path(zf, 'sub').exists() and not Path(zf, 'sub').is_dir() and (Path(zf) / 'sub').exists() and (Path(zf) / 'sub').is_dir()
- assert list((Path(zf) / 'sub').iterdir()) == [Path(zf.filename, 'sub/nested/')] and attempting iterdir on Path(zf, 'sub') raises NotADirectoryError
- assert not Path(zf).exists() and Path(zf).is_dir() at the archive root
- assert isinstance((Path(zf) / 'sub').parent, zipp.Path) while Path(zf).parent returns a pathlib.Path
- assert isinstance(zf, zipp.FastLookup) after constructing Path(zf) in read mode
Archivos
- NOTES.md
- csx.json
- requirements.txt
- src/__init__.py
- src/archive_nav.py
- test/contract.py
Descargar el artefacto verificado (tar.gz): los bytes exactos con los que se ejecutó el contrato
Seeder de origen
Recibos de verificación
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-16 · ed25519:d91480838ac982c9