parent
337a4199f9
commit
29e97d1d4a
4
black.py
4
black.py
@ -1044,6 +1044,10 @@ def _maybe_empty_lines(self, current_line: Line) -> Tuple[int, int]:
|
||||
# Don't insert empty lines between decorators.
|
||||
return 0, 0
|
||||
|
||||
if is_decorator and self.previous_line and self.previous_line.is_comment:
|
||||
# Don't insert empty lines between decorator comments.
|
||||
return 0, 0
|
||||
|
||||
newlines = 2
|
||||
if current_line.depth:
|
||||
newlines -= 1
|
||||
|
8
tests/comments6.py
Normal file
8
tests/comments6.py
Normal file
@ -0,0 +1,8 @@
|
||||
@property
|
||||
# TODO: X
|
||||
@property
|
||||
# TODO: Y
|
||||
# TODO: Z
|
||||
@property
|
||||
def foo():
|
||||
pass
|
@ -626,6 +626,14 @@ def test_check_diff_use_together(self) -> None:
|
||||
)
|
||||
self.assertEqual(result.exit_code, 1)
|
||||
|
||||
@patch("black.dump_to_file", dump_to_stderr)
|
||||
def test_comment_in_decorator(self) -> None:
|
||||
source, expected = read_data("comments6")
|
||||
actual = fs(source)
|
||||
self.assertFormatEqual(expected, actual)
|
||||
black.assert_equivalent(source, actual)
|
||||
black.assert_stable(source, actual, line_length=ll)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user