File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -373,4 +373,8 @@ def example_issue254():
373373
374374print (a
375375, end = ' ' )
376+ #: E133:3:1 --hang-closing
377+ a = [
378+ 12
379+ ]
376380#:
Original file line number Diff line number Diff line change @@ -146,6 +146,19 @@ def init_tests(pep8style):
146146 report = pep8style .init_report (TestReport )
147147 runner = pep8style .input_file
148148
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+
149162 def run_tests (filename ):
150163 """Run all the tests from a file."""
151164 lines = readlines (filename ) + ['#:\n ' ]
@@ -162,6 +175,9 @@ def run_tests(filename):
162175 if codes and index :
163176 if 'noeol' in codes :
164177 testcase [- 1 ] = testcase [- 1 ].rstrip ('\n ' )
178+
179+ codes = set_hang_closing_option (pep8style , codes )
180+
165181 codes = [c for c in codes
166182 if c not in ('Okay' , 'noeol' )]
167183 # Run the checker
You can’t perform that action at this time.
0 commit comments