MCPcopy Index your code
hub / github.com/python/cpython / build_alpharep_fixture

Function build_alpharep_fixture

Lib/test/test_zipfile/_path/test_path.py:28–74  ·  view source on GitHub ↗

Create a zip file with this structure: . ├── a.txt ├── n.txt (-> a.txt) ├── b │ ├── c.txt │ ├── d │ │ └── e.txt │ └── f.txt ├── g │ └── h │ └── i.txt └── j ├── k.bin ├── l.baz └── m.bar This fixture

()

Source from the content-addressed store, hash-verified

26
27
28def build_alpharep_fixture():
29 """
30 Create a zip file with this structure:
31
32 .
33 ├── a.txt
34 ├── n.txt (-> a.txt)
35 ├── b
36 │ ├── c.txt
37 │ ├── d
38 │ │ └── e.txt
39 │ └── f.txt
40 ├── g
41 │ └── h
42 │ └── i.txt
43 └── j
44 ├── k.bin
45 ├── l.baz
46 └── m.bar
47
48 This fixture has the following key characteristics:
49
50 - a file at the root (a)
51 - a file two levels deep (b/d/e)
52 - multiple files in a directory (b/c, b/f)
53 - a directory containing only a directory (g/h)
54 - a directory with files of different extensions (j/klm)
55 - a symlink (n) pointing to (a)
56
57 "alpha" because it uses alphabet
58 "rep" because it's a representative example
59 """
60 data = io.BytesIO()
61 zf = zipfile.ZipFile(data, "w")
62 zf.writestr("a.txt", b"content of a")
63 zf.writestr("b/c.txt", b"content of c")
64 zf.writestr("b/d/e.txt", b"content of e")
65 zf.writestr("b/f.txt", b"content of f")
66 zf.writestr("g/h/i.txt", b"content of i")
67 zf.writestr("j/k.bin", b"content of k")
68 zf.writestr("j/l.baz", b"content of l")
69 zf.writestr("j/m.bar", b"content of m")
70 zf.writestr("n.txt", b"a.txt")
71 _make_link(zf.infolist()[-1])
72
73 zf.filename = "alpharep.zip"
74 return zf
75
76
77alpharep_generators = [

Callers

nothing calls this directly

Calls 3

writestrMethod · 0.95
infolistMethod · 0.95
_make_linkFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…