|
1 | 1 | [case testWeakrefRef] |
| 2 | +import weakref |
| 3 | +from typing import Any, Callable |
| 4 | +def f(x: object) -> object: |
| 5 | + return weakref.ref(x) |
| 6 | + |
| 7 | +[out] |
| 8 | +def f(x): |
| 9 | + x :: object |
| 10 | + r0 :: object |
| 11 | +L0: |
| 12 | + r0 = PyWeakref_NewRef(x, NULL) |
| 13 | + return r0 |
| 14 | + |
| 15 | +[case testWeakrefRefCallback] |
| 16 | +import weakref |
| 17 | +from typing import Any, Callable |
| 18 | +def f(x: object, cb: Callable[[object], Any]) -> object: |
| 19 | + return weakref.ref(x, cb) |
| 20 | + |
| 21 | +[out] |
| 22 | +def f(x, cb): |
| 23 | + x, cb :: object |
| 24 | + r0 :: object |
| 25 | +L0: |
| 26 | + r0 = PyWeakref_NewRef(x, cb) |
| 27 | + return r0 |
| 28 | + |
| 29 | +[case testFromWeakrefRef] |
2 | 30 | from typing import Any, Callable |
3 | 31 | from weakref import ref |
4 | 32 | def f(x: object) -> object: |
|
12 | 40 | r0 = PyWeakref_NewRef(x, NULL) |
13 | 41 | return r0 |
14 | 42 |
|
15 | | -[case testWeakrefRefCallback] |
| 43 | +[case testFromWeakrefRefCallback] |
16 | 44 | from typing import Any, Callable |
17 | 45 | from weakref import ref |
18 | 46 | def f(x: object, cb: Callable[[object], Any]) -> object: |
|
27 | 55 | return r0 |
28 | 56 |
|
29 | 57 | [case testWeakrefProxy] |
| 58 | +import weakref |
| 59 | +from typing import Any, Callable |
| 60 | +def f(x: object) -> object: |
| 61 | + return weakref.proxy(x) |
| 62 | + |
| 63 | +[out] |
| 64 | +def f(x): |
| 65 | + x :: object |
| 66 | + r0 :: object |
| 67 | +L0: |
| 68 | + r0 = PyWeakref_NewProxy(x, NULL) |
| 69 | + return r0 |
| 70 | + |
| 71 | +[case testWeakrefProxyCallback] |
| 72 | +import weakref |
| 73 | +from typing import Any, Callable |
| 74 | +def f(x: object, cb: Callable[[object], Any]) -> object: |
| 75 | + return weakref.proxy(x, cb) |
| 76 | + |
| 77 | +[out] |
| 78 | +def f(x, cb): |
| 79 | + x, cb :: object |
| 80 | + r0 :: object |
| 81 | +L0: |
| 82 | + r0 = PyWeakref_NewProxy(x, cb) |
| 83 | + return r0 |
| 84 | + |
| 85 | +[case testFromWeakrefProxy] |
30 | 86 | from typing import Any, Callable |
31 | 87 | from weakref import proxy |
32 | 88 | def f(x: object) -> object: |
|
40 | 96 | r0 = PyWeakref_NewProxy(x, NULL) |
41 | 97 | return r0 |
42 | 98 |
|
43 | | -[case testWeakrefProxyCallback] |
| 99 | +[case testFromWeakrefProxyCallback] |
44 | 100 | from typing import Any, Callable |
45 | 101 | from weakref import proxy |
46 | 102 | def f(x: object, cb: Callable[[object], Any]) -> object: |
|
0 commit comments