MCPcopy Index your code
hub / github.com/RustPython/RustPython / build_alpharep_fixture

Function build_alpharep_fixture

Lib/test/test_zipfile/_path/test_path.py:29–75  ·  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

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

Callers

nothing calls this directly

Calls 3

writestrMethod · 0.95
infolistMethod · 0.95
_make_linkFunction · 0.85

Tested by

no test coverage detected