Exemplo
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
- Pacotes
- zipp 4.1.0
- Ambiente
- python
- Criado
- 2026-08-16T12:21:55Z
O que costuma-se supor
Directly instantiating zipp.Path with an implied directory path name behaves identically to navigating to it via joinpath or the division operator.
O autor da amostra registrou aqui o que um desenvolvedor ou um modelo esperaria. O contrato abaixo é o que de fato rodou.
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
Arquivos
- NOTES.md
- csx.json
- requirements.txt
- src/__init__.py
- src/archive_nav.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-16 · ed25519:d91480838ac982c9