summaryrefslogtreecommitdiff
path: root/testsuite/E30.py
blob: ebe4e9d254690a91a03e696e5ac41cfae3099c7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#: E301:5:5
class X:

    def a():
        pass
    def b():
        pass
#: E301:6:5
class X:

    def a():
        pass
    # comment
    def b():
        pass
#:


#: E302:2:1
"""Main module."""
def _main():
    pass
#: E302:2:1
import sys
def get_sys_path():
    return sys.path
#: E302:4:1
def a():
    pass

def b():
    pass
#: E302:6:1
def a():
    pass

# comment

def b():
    pass
#:
#: E302:4:1
def a():
    pass

async def b():
    pass
#:

#: E303:5:1
print



print
#: E303:5:1
print



# comment

print
#: E303:5:5 E303:8:5
def a():
    print


    # comment


    # another comment

    print
#:


#: E304:3:1
@decorator

def function():
    pass
#: E303:5:1
#!python



"""This class docstring comes on line 5.
It gives error E303: too many blank lines (3)
"""
#:

#: E305:7:1
def a():
    print

    # comment

    # another comment
a()
#: E305:8:1
def a():
    print

    # comment

    # another comment

try:
    a()
except Exception:
    pass
#: E305:5:1
def a():
    print

# Two spaces before comments, too.
if a():
    a()
#:

#: E306:3:5
def a():
    x = 1
    def b():
        pass
#: E306:3:5
async def a():
    x = 1
    def b():
        pass
#: E306:3:5 E306:5:9
def a():
    x = 2
    def b():
        x = 1
        def c():
            pass
#: E306:3:5 E306:6:5
def a():
    x = 1
    class C:
        pass
    x = 2
    def b():
        pass
#:

#: E305:8:1
# Example from https://github.com/PyCQA/pycodestyle/issues/400
import stuff


def main():
    blah, blah

if __name__ == '__main__':
    main()
# Previously just E272:1:6 E272:4:6
#: E302:4:1 E271:1:6 E271:4:6
async  def x():
    pass

async  def x(y: int = 1):
    pass
#: E704:3:1 E302:3:1
def bar():
    pass
def baz(): pass
#: E704:1:1 E302:2:1
def bar(): pass
def baz():
    pass
#: E704:4:5 E306:4:5
def foo():
    def bar():
        pass
    def baz(): pass
#: E704:2:5 E306:3:5
def foo():
    def bar(): pass
    def baz():
        pass
#: E302:5:1
def f():
    pass

# wat
@hi
def g():
    pass