1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
[case testPEP696TypeAlias]
type A[T = int] = C[T]
[out]
MypyFile:1(
TypeAliasStmt:1(
NameExpr(A)
TypeParam(
T
Default(
int?))
LambdaExpr:1(
Block:-1(
ReturnStmt:1(
IndexExpr:1(
NameExpr(C)
NameExpr(T)))))))
[case testPEP696GenericFunction]
def f[T = int](): pass
class C[T = int]: pass
[out]
MypyFile:1(
FuncDef:1(
f
TypeParam(
T
Default(
int?))
Block:1(
PassStmt:1()))
ClassDef:2(
C
TypeParam(
T
Default(
int?))
PassStmt:2()))
[case testPEP696ParamSpec]
def f[**P = [int, str]](): pass
class C[**P = [int, str]]: pass
[out]
[out]
MypyFile:1(
FuncDef:1(
f
TypeParam(
**P
Default(
<TypeList int?, str?>))
Block:1(
PassStmt:1()))
ClassDef:2(
C
TypeParam(
**P
Default(
<TypeList int?, str?>))
PassStmt:2()))
[case testPEP696TypeVarTuple]
def f[*Ts = *tuple[str, int]](): pass
class C[*Ts = *tuple[str, int]]: pass
[out]
MypyFile:1(
FuncDef:1(
f
TypeParam(
*Ts
Default(
Unpack[tuple?[str?, int?]]))
Block:1(
PassStmt:1()))
ClassDef:2(
C
TypeParam(
*Ts
Default(
Unpack[tuple?[str?, int?]]))
PassStmt:2()))
|