Python code coverage for Lib/test/ann_module3.py
# | count | content |
---|---|---|
1 | n/a | """ |
2 | n/a | Correct syntax for variable annotation that should fail at runtime |
3 | n/a | in a certain manner. More examples are in test_grammar and test_parser. |
4 | n/a | """ |
5 | n/a | |
6 | n/a | def f_bad_ann(): |
7 | n/a | __annotations__[1] = 2 |
8 | n/a | |
9 | n/a | class C_OK: |
10 | n/a | def __init__(self, x: int) -> None: |
11 | n/a | self.x: no_such_name = x # This one is OK as proposed by Guido |
12 | n/a | |
13 | n/a | class D_bad_ann: |
14 | n/a | def __init__(self, x: int) -> None: |
15 | n/a | sfel.y: int = 0 |
16 | n/a | |
17 | n/a | def g_bad_ann(): |
18 | n/a | no_such_name.attr: int = 0 |