Home | History | Annotate | Download | only in test
      1 """
      2 Correct syntax for variable annotation that should fail at runtime
      3 in a certain manner. More examples are in test_grammar and test_parser.
      4 """
      5 
      6 def f_bad_ann():
      7     __annotations__[1] = 2
      8 
      9 class 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 
     13 class D_bad_ann:
     14     def __init__(self, x: int) -> None:
     15         sfel.y: int = 0
     16 
     17 def g_bad_ann():
     18     no_such_name.attr: int = 0
     19