blob: 76cf5b3ad97e62b5275880cb073362364f9e63b1 [file] [log] [blame]
Yury Selivanovf8cb8a12016-09-08 20:50:03 -07001"""
2Some correct syntax for variable annotation here.
3More examples are in test_grammar and test_parser.
4"""
5
6from typing import no_type_check, ClassVar
7
8i: int = 1
9j: int
10x: float = i/10
11
12def f():
13 class C: ...
14 return C()
15
16f().new_attr: object = object()
17
18class C:
19 def __init__(self, x: int) -> None:
20 self.x = x
21
22c = C(5)
23c.new_attr: int = 10
24
25__annotations__ = {}
26
27
28@no_type_check
29class NTC:
30 def meth(self, param: complex) -> None:
31 ...
32
33class CV:
34 var: ClassVar['CV']
35
36CV.var = CV()