blob: eccd7be22dd894001ead7313de11bfd390da1ee6 [file] [log] [blame]
Yury Selivanovf8cb8a12016-09-08 20:50:03 -07001"""
2Correct syntax for variable annotation that should fail at runtime
3in a certain manner. More examples are in test_grammar and test_parser.
4"""
5
6def f_bad_ann():
7 __annotations__[1] = 2
8
9class C_OK:
10 def __init__(self, x: int) -> None:
11 self.x: no_such_name = x # This one is OK as proposed by Guido
12
13class D_bad_ann:
14 def __init__(self, x: int) -> None:
15 sfel.y: int = 0
16
17def g_bad_ann():
18 no_such_name.attr: int = 0