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

Python code coverage for Lib/test/ann_module.py

#countcontent
1n/a
2n/a
3n/a"""
4n/aThe module for testing variable annotations.
5n/aEmpty lines above are for good reason (testing for correct line numbers)
6n/a"""
7n/a
8n/afrom typing import Optional
9n/a
10n/a__annotations__[1] = 2
11n/a
12n/aclass C:
13n/a
14n/a x = 5; y: Optional['C'] = None
15n/a
16n/afrom typing import Tuple
17n/ax: int = 5; y: str = x; f: Tuple[int, int]
18n/a
19n/aclass M(type):
20n/a
21n/a __annotations__['123'] = 123
22n/a o: type = object
23n/a
24n/a(pars): bool = True
25n/a
26n/aclass D(C):
27n/a j: str = 'hi'; k: str= 'bye'
28n/a
29n/afrom types import new_class
30n/ah_class = new_class('H', (C,))
31n/aj_class = new_class('J')
32n/a
33n/aclass F():
34n/a z: int = 5
35n/a def __init__(self, x):
36n/a pass
37n/a
38n/aclass Y(F):
39n/a def __init__(self):
40n/a super(F, self).__init__(123)
41n/a
42n/aclass Meta(type):
43n/a def __new__(meta, name, bases, namespace):
44n/a return super().__new__(meta, name, bases, namespace)
45n/a
46n/aclass S(metaclass = Meta):
47n/a x: str = 'something'
48n/a y: str = 'something else'
49n/a
50n/adef foo(x: int = 10):
51n/a def bar(y: List[str]):
52n/a x: str = 'yes'
53n/a bar()