Debian Codegraph @

mypyc/test-data/capsule-deps.test

raw
1 [case testNoDeps]
2 def f() -> None:
3 pass
4 [out]
5 No deps
6
7 [case testStringsCapsuleDep]
8 from librt.strings import StringWriter
9
10 def f() -> None:
11 StringWriter()
12 [out]
13 Capsule(name='librt.strings')
14
15 [case testStringsCapsuleDepFromParamType]
16 from librt.strings import StringWriter
17
18 def f(s: StringWriter) -> None:
19 pass
20 [out]
21 Capsule(name='librt.strings')
22
23 [case testStringsCapsuleDepFromReturnType]
24 from librt.strings import StringWriter
25
26 def f() -> StringWriter:
27 assert False
28 [out]
29 Capsule(name='librt.strings')
30
31 [case testStringsCapsuleDepFromUnion]
32 from typing import Union
33
34 from librt.strings import StringWriter
35
36 def f(s: Union[StringWriter, str]) -> None:
37 pass
38 [out]
39 Capsule(name='librt.strings')
40
41 [case testStringsCapsuleDepFromTuple]
42 from librt.strings import StringWriter
43
44 def f(s: tuple[int, StringWriter]) -> None:
45 pass
46 [out]
47 Capsule(name='librt.strings')
48
49 [case testExtraFileDep]
50 from librt.strings import StringWriter
51
52 def f(s: StringWriter) -> int:
53 return s[0]
54 [out]
55 Capsule(name='librt.strings')
56 SourceDep(path='stringwriter_extra_ops.c')
57
58 [case testMultipleCapsuleDeps1_experimental]
59 from librt.strings import StringWriter
60 from librt.base64 import b64encode
61
62 def f() -> None:
63 StringWriter()
64
65 def g() -> bytes:
66 return b64encode(b'foo')
67 [out]
68 Capsule(name='librt.base64')
69 Capsule(name='librt.strings')
70
71 [case testMultipleCapsuleDeps2_experimental]
72 from librt.strings import StringWriter
73 from librt.base64 import b64encode
74
75 def f() -> bytes:
76 StringWriter()
77 return b64encode(b'foo')
78 [out]
79 Capsule(name='librt.base64')
80 Capsule(name='librt.strings')
81
82 [case testVecCapsuleDepInFunction]
83 from librt.vecs import vec
84
85 def f() -> None:
86 vec[str]()
87 [out]
88 Capsule(name='librt.vecs')
89
90 [case testVecCapsuleDepInMethod]
91 from librt.vecs import vec
92
93 class C:
94 def m(self) -> None:
95 vec[str]()
96 [out]
97 Capsule(name='librt.vecs')
98
99 [case testVecCapsuleDepAtTopLevel]
100 from librt.vecs import vec
101
102 vec[str]()
103 [out]
104 Capsule(name='librt.vecs')
105
106 [case testVecCapsuleDepInAttributeType]
107 from librt.vecs import vec
108
109 class C:
110 v: vec[str]
111 [out]
112 Capsule(name='librt.vecs')