github.com/cheshirekow/buildtools@v0.0.0-20200224190056-5d637702fe81/build/testdata/058.golden (about) 1 def f(): 2 if foo: 3 return bar 4 5 # these comments 6 # belong to the next statement 7 def f(): 8 if foo: 9 return bar 10 11 # these comments 12 # belong to the top level 13 14 def f(): 15 if foo: 16 return bar 17 18 # these comments 19 # belong to the top level 20 21 def f(): 22 if foo: 23 return bar 24 # this comment belongs to the return statement 25 26 # these comments are aligned 27 # with the if-statement as after-comments 28 29 # this should have the same indentation level as above 30 31 # but this line belongs to the top level 32 33 # and this belongs to the following for-loop 34 for a in b: 35 if foo: 36 pass 37 # this comment is aligned with pass 38 39 # this comment is aligned with pass 40 41 # this comment is aligned with pass 42 pass 43 elif bar: 44 pass 45 46 # this comment is aligned with pass 47 # this comment is aligned with pass 48 49 # this comment is aligned with elif 50 # this comment is aligned with elif 51 52 # this comment is aligned with for 53 # this comment is aligned with for 54 55 for a in b: 56 if foo: 57 pass 58 elif bar: 59 pass 60 61 # all 62 # of 63 # these 64 # comments 65 # are 66 # not 67 # indented 68 69 for a in b: 70 if foo: 71 pass 72 elif bar: 73 pass 74 else: 75 pass # This comment stays here 76 77 # all 78 # of 79 # these 80 # comments 81 82 # are 83 # aligned 84 # with 85 # else 86 87 def foo(): 88 return # This comment stays here 89 # this comment belongs to the return statement 90 91 # this comment belongs to the function 92 93 # but these belong 94 95 # to the top level