diff --git a/python/testData/formatter/trailingBlockCommentsIndentationPreserved.py b/python/testData/formatter/trailingBlockCommentsIndentationPreserved.py new file mode 100644 index 000000000000..81759d319cf4 --- /dev/null +++ b/python/testData/formatter/trailingBlockCommentsIndentationPreserved.py @@ -0,0 +1,10 @@ +class C: + def method(self): + def foo(): + def bar(): + pass + # bar + # bar + # bar + # method + # class diff --git a/python/testData/formatter/trailingBlockCommentsIndentationPreserved_after.py b/python/testData/formatter/trailingBlockCommentsIndentationPreserved_after.py new file mode 100644 index 000000000000..20f0373a2afe --- /dev/null +++ b/python/testData/formatter/trailingBlockCommentsIndentationPreserved_after.py @@ -0,0 +1,10 @@ +class C: + def method(self): + def foo(): + def bar(): + pass + # bar + # bar + # bar + # method + # class diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java index 9c4b0fa6a8c6..6b873248bf66 100644 --- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java +++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java @@ -852,6 +852,11 @@ public class PyFormatterTest extends PyTestCase { doTest(); } + // PY-15051 + public void testTrailingBlockCommentsIndentationPreserved() { + doTest(); + } + public void testVariableAnnotations() { runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest); }