-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow empty line after block open before a comment or compound statem…
…ent (#3967)
- Loading branch information
1 parent
0a37888
commit 2db5ab0
Showing
5 changed files
with
138 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
tests/data/cases/preview_allow_empty_first_line_in_special_cases.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# flags: --preview | ||
def foo(): | ||
""" | ||
Docstring | ||
""" | ||
|
||
# Here we go | ||
if x: | ||
|
||
# This is also now fine | ||
a = 123 | ||
|
||
else: | ||
# But not necessary | ||
a = 123 | ||
|
||
if y: | ||
|
||
while True: | ||
|
||
""" | ||
Long comment here | ||
""" | ||
a = 123 | ||
|
||
if z: | ||
|
||
for _ in range(100): | ||
a = 123 | ||
else: | ||
|
||
try: | ||
|
||
# this should be ok | ||
a = 123 | ||
except: | ||
|
||
"""also this""" | ||
a = 123 | ||
|
||
|
||
def bar(): | ||
|
||
if x: | ||
a = 123 | ||
|
||
|
||
def baz(): | ||
|
||
# OK | ||
if x: | ||
a = 123 | ||
|
||
# output | ||
|
||
def foo(): | ||
""" | ||
Docstring | ||
""" | ||
|
||
# Here we go | ||
if x: | ||
|
||
# This is also now fine | ||
a = 123 | ||
|
||
else: | ||
# But not necessary | ||
a = 123 | ||
|
||
if y: | ||
|
||
while True: | ||
|
||
""" | ||
Long comment here | ||
""" | ||
a = 123 | ||
|
||
if z: | ||
|
||
for _ in range(100): | ||
a = 123 | ||
else: | ||
|
||
try: | ||
|
||
# this should be ok | ||
a = 123 | ||
except: | ||
|
||
"""also this""" | ||
a = 123 | ||
|
||
|
||
def bar(): | ||
|
||
if x: | ||
a = 123 | ||
|
||
|
||
def baz(): | ||
|
||
# OK | ||
if x: | ||
a = 123 |