• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
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
19