File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -373,4 +373,8 @@ def example_issue254():
373
373
374
374
print (a
375
375
, end = ' ' )
376
+ #: E133:3:1 --hang-closing
377
+ a = [
378
+ 12
379
+ ]
376
380
#:
Original file line number Diff line number Diff line change @@ -146,6 +146,19 @@ def init_tests(pep8style):
146
146
report = pep8style .init_report (TestReport )
147
147
runner = pep8style .input_file
148
148
149
+ def set_hang_closing_option (pep8style , codes ):
150
+ """Set hang-closing option if present in the test codes.
151
+
152
+ (mutates pep8style)
153
+
154
+ Usage in test:
155
+ #: #E133:3:1 --with-hanging
156
+
157
+ """
158
+ pep8style .options .hang_closing = '--hang-closing' in codes
159
+ codes = [c for c in codes if c != '--hang-closing' ]
160
+ return codes
161
+
149
162
def run_tests (filename ):
150
163
"""Run all the tests from a file."""
151
164
lines = readlines (filename ) + ['#:\n ' ]
@@ -162,6 +175,9 @@ def run_tests(filename):
162
175
if codes and index :
163
176
if 'noeol' in codes :
164
177
testcase [- 1 ] = testcase [- 1 ].rstrip ('\n ' )
178
+
179
+ codes = set_hang_closing_option (pep8style , codes )
180
+
165
181
codes = [c for c in codes
166
182
if c not in ('Okay' , 'noeol' )]
167
183
# Run the checker
You can’t perform that action at this time.
0 commit comments