Extract method PyTestCase#getIndentOptions()
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Mon, 21 Sep 2015 12:20:42 +0000 (15:20 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Wed, 23 Sep 2015 15:42:17 +0000 (18:42 +0300)
python/testSrc/com/jetbrains/python/PyEditingTest.java
python/testSrc/com/jetbrains/python/PyFormatterTest.java
python/testSrc/com/jetbrains/python/PyQuickFixTest.java
python/testSrc/com/jetbrains/python/PySmartEnterTest.java
python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java
python/testSrc/com/jetbrains/python/intentions/PyIntentionTest.java
python/testSrc/com/jetbrains/python/refactoring/changeSignature/PyChangeSignatureTest.java

index 3428a30fe8b34255822c585bb6f5dea8d5124c5b..0c3c3d796254cc7a565b3958a7df05423dd089dc 100644 (file)
@@ -253,7 +253,7 @@ public class PyEditingTest extends PyTestCase {
 
   // PY-16765
   public void testSectionIndentInsideGoogleDocStringCustomIndent() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doDocStringTypingTest("\nparam", DocStringFormat.GOOGLE);
   }
 
index fc985ef6e32bc5bade1b5021916996dddbf78169..62f7f76454924e3c2a5b9dca79b05b51c05b1bc5 100644 (file)
@@ -479,7 +479,7 @@ public class PyFormatterTest extends PyTestCase {
 
   // PY-14408
   public void testIndentsWithTabsInsideDictLiteral() {
-    getCommonCodeStyleSettings().getIndentOptions().USE_TAB_CHARACTER = true;
+    getIndentOptions().USE_TAB_CHARACTER = true;
     doTest();
   }
 
index e1e9d76cdc3adf3579b0fa665fbe2eddc2017ee5..24c4b90f513b76525771de81dae43e7d5e29380f 100644 (file)
@@ -323,13 +323,13 @@ public class PyQuickFixTest extends PyTestCase {
 
   // PY-1445
   public void testConvertSingleQuotedDocstring() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doInspectionTest(PySingleQuotedDocstringInspection.class, PyBundle.message("QFIX.convert.single.quoted.docstring"), true, true);
   }
 
   // PY-8926
   public void testConvertSingleQuotedDocstringEscape() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doInspectionTest(PySingleQuotedDocstringInspection.class, PyBundle.message("QFIX.convert.single.quoted.docstring"), true, true);
   }
 
@@ -438,7 +438,7 @@ public class PyQuickFixTest extends PyTestCase {
 
   // PY-3394
   public void testDocstringParams() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     runWithDocStringFormat(DocStringFormat.EPYTEXT, new Runnable() {
       public void run() {
         doInspectionTest(PyDocstringInspection.class, PyBundle.message("QFIX.docstring.add.$0", "b"), true, true);
@@ -447,7 +447,7 @@ public class PyQuickFixTest extends PyTestCase {
   }
 
   public void testDocstringParams1() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     runWithDocStringFormat(DocStringFormat.EPYTEXT, new Runnable() {
       public void run() {
         doInspectionTest(PyDocstringInspection.class, PyBundle.message("QFIX.docstring.remove.$0", "c"), true, true);
index ac609850a7b66273b200b7b7dc8c5aaf8555e19a..f561c1a35a134da212475b1e32752fca642dbeb0 100644 (file)
@@ -237,7 +237,7 @@ public class PySmartEnterTest extends PyTestCase {
 
   // PY-16765
   public void testGoogleDocStringIndentAfterSectionCustomIndent() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     runWithDocStringFormat(DocStringFormat.GOOGLE, new Runnable() {
       public void run() {
         doTest();
index 6f485c53fcb43bc2626e3b5f1f9872682738d874..ae436c2f45d22ecfa7da8f57ee93b16d7bd1fdfc 100644 (file)
@@ -433,5 +433,11 @@ public abstract class PyTestCase extends UsefulTestCase {
   protected CodeStyleSettings getCodeStyleSettings() {
     return CodeStyleSettingsManager.getSettings(myFixture.getProject());
   }
+
+  @NotNull
+  protected CommonCodeStyleSettings.IndentOptions getIndentOptions() {
+    //noinspection ConstantConditions
+    return getCommonCodeStyleSettings().getIndentOptions();
+  }
 }
 
index a551418fcb16770001dc9664b1df689ead2a112f..7d23e79313ffbaea85535404bc198894ec7418b1 100644 (file)
@@ -214,7 +214,7 @@ public class  PyIntentionTest extends PyTestCase {
   }
 
   public void testMultilineQuotedString() { //PY-8064
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doTest(PyBundle.message("INTN.quoted.string.double.to.single"));
   }
 
@@ -287,7 +287,7 @@ public class  PyIntentionTest extends PyTestCase {
   }
 
   public void testTypeInDocstring() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doDocParamTypeTest(DocStringFormat.REST);
   }
 
@@ -304,7 +304,7 @@ public class  PyIntentionTest extends PyTestCase {
   }
 
   public void testTypeInDocstring5() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doDocParamTypeTest(DocStringFormat.REST);
   }
 
@@ -335,12 +335,12 @@ public class  PyIntentionTest extends PyTestCase {
   }
 
   public void testTypeInDocstring1() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doDocReturnTypeTest(DocStringFormat.REST);
   }
 
   public void testTypeInDocstring2() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doDocReturnTypeTest(DocStringFormat.REST);
   }
 
@@ -411,7 +411,7 @@ public class  PyIntentionTest extends PyTestCase {
   }
 
   public void testDocStubKeywordOnly() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     runWithLanguageLevel(LanguageLevel.PYTHON27, new Runnable() {
       public void run() {
         doDocStubTest(DocStringFormat.REST);
@@ -421,7 +421,7 @@ public class  PyIntentionTest extends PyTestCase {
 
   // PY-16765
   public void testGoogleDocStubCustomIndent() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doDocStubTest(DocStringFormat.GOOGLE);
   }
 
@@ -573,7 +573,7 @@ public class  PyIntentionTest extends PyTestCase {
   
   // PY-16765
   public void testAddMissingParamsInGoogleDocStringNoParamSectionCustomCodeIndent() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doDocAddMissingParamsTest(DocStringFormat.GOOGLE);
   }
   
@@ -584,7 +584,7 @@ public class  PyIntentionTest extends PyTestCase {
   
   // PY-16765
   public void testAddMissingParamsInGoogleDocStringEmptyParamSectionCustomCodeIndent() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doDocAddMissingParamsTest(DocStringFormat.GOOGLE);
   }
 
index 066f7b7f3c8f254ef1be716205dfff80c748419c..590dcee680f977089532eb7547d6dd86712c182a 100644 (file)
@@ -94,7 +94,7 @@ public class PyChangeSignatureTest extends PyTestCase {
   }
 
   public void testUpdateDocstring() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     final PyParameterInfo a = new PyParameterInfo(0, "a", null, false);
     final PyParameterInfo d1 = new PyParameterInfo(1, "d", "1", true);
     d1.setName("d1");
@@ -102,7 +102,7 @@ public class PyChangeSignatureTest extends PyTestCase {
   }
 
   public void testFixDocstringRemove() {
-    getCommonCodeStyleSettings().getIndentOptions().INDENT_SIZE = 2;
+    getIndentOptions().INDENT_SIZE = 2;
     doChangeSignatureTest(null, Arrays.asList(new PyParameterInfo(0, "a", null, false)));
   }