PY-6637 Add sample test case for detection of local function
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Wed, 30 Sep 2015 11:52:42 +0000 (14:52 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Mon, 5 Oct 2015 10:09:01 +0000 (13:09 +0300)
python/testData/refactoring/convertTopLevel/localFunctionDetection.py [new file with mode: 0644]
python/testSrc/com/jetbrains/python/refactoring/PyConvertLocalFunctionToTopLevelFunctionTest.java

diff --git a/python/testData/refactoring/convertTopLevel/localFunctionDetection.py b/python/testData/refactoring/convertTopLevel/localFunctionDetection.py
new file mode 100644 (file)
index 0000000..0276a20
--- /dev/null
@@ -0,0 +1,3 @@
+def fu<caret>nc():
+    def local():
+        pass
\ No newline at end of file
index f6f5cc6e4433a53ce47e5f15693475de0d30a524..d45e385e6aa74c7539877e3d6ea74bb31506b546 100644 (file)
@@ -34,6 +34,15 @@ public class PyConvertLocalFunctionToTopLevelFunctionTest extends PyTestCase {
     doTest();
   }
 
+  // PY-6637
+  public void testLocalFunctionDetection() {
+    myFixture.configureByFile(getTestName(true) + ".py");
+    moveByText("func");
+    assertFalse(myFixture.testAction(new PyConvertLocalFunctionToTopLevelFunctionAction()).isEnabled());
+    moveByText("local");
+    assertTrue(myFixture.testAction(new PyConvertLocalFunctionToTopLevelFunctionAction()).isEnabled());
+  }
+
   @Override
   protected String getTestDataPath() {
     return super.getTestDataPath() + "/refactoring/convertTopLevel/";