ยปCore Development>Code coverage>Lib/test/ann_module3.py

Python code coverage for Lib/test/ann_module3.py

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