File: semanal-lambda.test

package info (click to toggle)
mypy 1.19.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,412 kB
  • sloc: python: 114,754; ansic: 13,343; cpp: 11,380; makefile: 257; sh: 28
file content (94 lines) | stat: -rw-r--r-- 3,092 bytes parent folder | download | duplicates (2)
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
[case testLambdaInheritsCheckedContextFromFunc]
def g():
    return lambda x: UNDEFINED in x
[out]
MypyFile:1(
  FuncDef:1(
    g
    Block:2(
      ReturnStmt:2(
        LambdaExpr:2(
          Args(
            Var(x))
          Block:2(
            ReturnStmt:2(
              ComparisonExpr:2(
                in
                NameExpr(UNDEFINED)
                NameExpr(x [l])))))))))

[case testLambdaInheritsCheckedContextFromFuncForced]
# flags: --check-untyped-defs
def g():
    return lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromTypedFunc]
def g() -> None:
    return lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromTypedFuncForced]
# flags: --check-untyped-defs
def g() -> None:
    return lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromModule]
g = lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromModuleForce]
# flags: --check-untyped-defs
g = lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromModuleLambdaStack]
g = lambda: lambda: lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromModuleLambdaStackForce]
# flags: --check-untyped-defs
g = lambda: lambda: lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromFuncLambdaStack]
def g():
    return lambda: lambda: lambda x: UNDEFINED in x
[out]
MypyFile:1(
  FuncDef:1(
    g
    Block:2(
      ReturnStmt:2(
        LambdaExpr:2(
          Block:2(
            ReturnStmt:2(
              LambdaExpr:2(
                Block:2(
                  ReturnStmt:2(
                    LambdaExpr:2(
                      Args(
                        Var(x))
                      Block:2(
                        ReturnStmt:2(
                          ComparisonExpr:2(
                            in
                            NameExpr(UNDEFINED)
                            NameExpr(x [l])))))))))))))))

[case testLambdaInheritsCheckedContextFromFuncLambdaStackForce]
# flags: --check-untyped-defs
def g():
    return lambda: lambda: lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromTypedFuncLambdaStack]
def g() -> None:
    return lambda: lambda: lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromTypedFuncLambdaStackForce]
# flags: --check-untyped-defs
def g() -> None:
    return lambda: lambda: lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromClassLambdaStack]
class A:
    g = lambda: lambda: lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined

[case testLambdaInheritsCheckedContextFromClassLambdaStackForce]
# flags: --check-untyped-defs
class A:
    g = lambda: lambda: lambda x: UNDEFINED in x  # E: Name "UNDEFINED" is not defined