From 1fcf101da89e35fd2938697856601f0964df141f Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Mon, 9 Feb 2015 19:56:33 +0300 Subject: [PATCH] Add test cases for comment formatting scenarios described in PY-12938 --- .../testData/formatter/docCommentIgnored.py | 4 ++++ .../formatter/docCommentIgnored_after.py | 4 ++++ .../formatter/doubleHashCommentIgnored.py | 6 ++++++ .../doubleHashCommentIgnored_after.py | 6 ++++++ .../{shebang.py => shebangCommentIgnored.py} | 0 ...fter.py => shebangCommentIgnored_after.py} | 0 .../com/jetbrains/python/PyFormatterTest.java | 19 +++++++++++++++---- 7 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 python/testData/formatter/docCommentIgnored.py create mode 100644 python/testData/formatter/docCommentIgnored_after.py create mode 100644 python/testData/formatter/doubleHashCommentIgnored.py create mode 100644 python/testData/formatter/doubleHashCommentIgnored_after.py rename python/testData/formatter/{shebang.py => shebangCommentIgnored.py} (100%) rename python/testData/formatter/{shebang_after.py => shebangCommentIgnored_after.py} (100%) diff --git a/python/testData/formatter/docCommentIgnored.py b/python/testData/formatter/docCommentIgnored.py new file mode 100644 index 000000000000..08a8959972a7 --- /dev/null +++ b/python/testData/formatter/docCommentIgnored.py @@ -0,0 +1,4 @@ +#: :type: dict of (str, C) +d = {'foo': C()} +#: :type: list of str +xs = ['bar'] \ No newline at end of file diff --git a/python/testData/formatter/docCommentIgnored_after.py b/python/testData/formatter/docCommentIgnored_after.py new file mode 100644 index 000000000000..08a8959972a7 --- /dev/null +++ b/python/testData/formatter/docCommentIgnored_after.py @@ -0,0 +1,4 @@ +#: :type: dict of (str, C) +d = {'foo': C()} +#: :type: list of str +xs = ['bar'] \ No newline at end of file diff --git a/python/testData/formatter/doubleHashCommentIgnored.py b/python/testData/formatter/doubleHashCommentIgnored.py new file mode 100644 index 000000000000..f1501b360660 --- /dev/null +++ b/python/testData/formatter/doubleHashCommentIgnored.py @@ -0,0 +1,6 @@ +########### +## +## MANUAL +## + +print('Spam') \ No newline at end of file diff --git a/python/testData/formatter/doubleHashCommentIgnored_after.py b/python/testData/formatter/doubleHashCommentIgnored_after.py new file mode 100644 index 000000000000..f1501b360660 --- /dev/null +++ b/python/testData/formatter/doubleHashCommentIgnored_after.py @@ -0,0 +1,6 @@ +########### +## +## MANUAL +## + +print('Spam') \ No newline at end of file diff --git a/python/testData/formatter/shebang.py b/python/testData/formatter/shebangCommentIgnored.py similarity index 100% rename from python/testData/formatter/shebang.py rename to python/testData/formatter/shebangCommentIgnored.py diff --git a/python/testData/formatter/shebang_after.py b/python/testData/formatter/shebangCommentIgnored_after.py similarity index 100% rename from python/testData/formatter/shebang_after.py rename to python/testData/formatter/shebangCommentIgnored_after.py diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java index 9933085dbdd7..4a5f55e0b35b 100644 --- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java +++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java @@ -401,10 +401,6 @@ public class PyFormatterTest extends PyTestCase { doTest(); } - public void testShebang() { //PY-12775 - doTest(); - } - public void testParenthesisAroundGeneratorExpression() { doTest(); } @@ -505,6 +501,21 @@ public class PyFormatterTest extends PyTestCase { doTest(); } + // PY-12938 + public void testDoubleHashCommentIgnored() { + doTest(); + } + + // PY-12938 + public void testDocCommentIgnored() { + doTest(); + } + + // PY-12775 + public void testShebangCommentIgnored() { + doTest(); + } + /** * This test merely checks that call to {@link com.intellij.psi.codeStyle.CodeStyleManager#reformat(com.intellij.psi.PsiElement)} * is possible for Python sources.