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

Python code coverage for Lib/test/ann_module2.py

#countcontent
1n/a"""
2n/aSome correct syntax for variable annotation here.
3n/aMore examples are in test_grammar and test_parser.
4n/a"""
5n/a
6n/afrom typing import no_type_check, ClassVar
7n/a
8n/ai: int = 1
9n/aj: int
10n/ax: float = i/10
11n/a
12n/adef f():
13n/a class C: ...
14n/a return C()
15n/a
16n/af().new_attr: object = object()
17n/a
18n/aclass C:
19n/a def __init__(self, x: int) -> None:
20n/a self.x = x
21n/a
22n/ac = C(5)
23n/ac.new_attr: int = 10
24n/a
25n/a__annotations__ = {}
26n/a
27n/a
28n/a@no_type_check
29n/aclass NTC:
30n/a def meth(self, param: complex) -> None:
31n/a ...
32n/a
33n/aclass CV:
34n/a var: ClassVar['CV']
35n/a
36n/aCV.var = CV()