@@ -271,7 +271,7 @@ def test_format_block_comments_should_only_touch_real_comments(self):
271271 commented_out_code = '#x = 1'
272272 self .assertEqual (
273273 commented_out_code ,
274- fix_e265_and_e266 (commented_out_code ))
274+ fix_e266 (commented_out_code ))
275275
276276 def test_fix_file (self ):
277277 self .assertIn (
@@ -2238,6 +2238,12 @@ def test_e265_only(self):
22382238 with autopep8_context (line , options = ['--select=E265' ]) as result :
22392239 self .assertEqual (fixed , result )
22402240
2241+ def test_e265_issue662 (self ):
2242+ line = "#print(\" \" )\n "
2243+ fixed = "# print(\" \" )\n "
2244+ with autopep8_context (line , options = ['--select=E265' ]) as result :
2245+ self .assertEqual (fixed , result )
2246+
22412247 def test_ignore_e265 (self ):
22422248 line = "## A comment\n #B comment\n 123\n "
22432249 fixed = "# A comment\n #B comment\n 123\n "
@@ -2256,6 +2262,12 @@ def test_e266_only(self):
22562262 with autopep8_context (line , options = ['--select=E266' ]) as result :
22572263 self .assertEqual (fixed , result )
22582264
2265+ def test_e266_issue662 (self ):
2266+ line = "## comment\n "
2267+ fixed = "# comment\n "
2268+ with autopep8_context (line ) as result :
2269+ self .assertEqual (fixed , result )
2270+
22592271 def test_ignore_e266 (self ):
22602272 line = "##A comment\n #B comment\n 123\n "
22612273 fixed = "## A comment\n # B comment\n 123\n "
@@ -3167,7 +3179,7 @@ def test_e501_with_comment(self):
31673179# http://foo.bar/abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-
31683180
31693181# The following is ugly commented-out code and should not be touched.
3170- #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = 1
3182+ # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = 1
31713183"""
31723184 with autopep8_context (line , options = ['--aggressive' ]) as result :
31733185 self .assertEqual (fixed , result )
@@ -6442,7 +6454,7 @@ def test_e501_experimental_with_comment(self):
64426454# http://foo.bar/abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-abc-
64436455
64446456# The following is ugly commented-out code and should not be touched.
6445- #xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = 1
6457+ # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx = 1
64466458"""
64476459 with autopep8_context (line , options = ['--experimental' ,
64486460 '--aggressive' ]) as result :
@@ -7287,6 +7299,11 @@ def test_e501_experimental_with_in(self):
72877299 self .assertEqual (fixed , result )
72887300
72897301
7302+ def fix_e266 (source ):
7303+ with autopep8_context (source , options = ['--select=E266' ]) as result :
7304+ return result
7305+
7306+
72907307def fix_e265_and_e266 (source ):
72917308 with autopep8_context (source , options = ['--select=E265,E266' ]) as result :
72927309 return result
0 commit comments