PY-17265 Add missing test on handling imports for moved local function
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Tue, 18 Oct 2016 15:03:19 +0000 (18:03 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Mon, 24 Oct 2016 21:03:49 +0000 (00:03 +0300)
python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/after/main.py [new file with mode: 0644]
python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/after/util.py [new file with mode: 0644]
python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/before/main.py [new file with mode: 0644]
python/testSrc/com/jetbrains/python/refactoring/PyMakeFunctionTopLevelTest.java

diff --git a/python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/after/main.py b/python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/after/main.py
new file mode 100644 (file)
index 0000000..d602112
--- /dev/null
@@ -0,0 +1,9 @@
+CONST = 42
+
+
+class MyClass:
+    pass
+
+
+def f():
+    pass
diff --git a/python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/after/util.py b/python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/after/util.py
new file mode 100644 (file)
index 0000000..342d6d7
--- /dev/null
@@ -0,0 +1,10 @@
+from sys import path
+
+from main import f, MyClass, CONST
+
+
+def g():
+    f()
+    print(MyClass())
+    print(path)
+    print(CONST)
\ No newline at end of file
diff --git a/python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/before/main.py b/python/testData/refactoring/makeFunctionTopLevel/localFunctionMoveToOtherFile/before/main.py
new file mode 100644 (file)
index 0000000..508e4a5
--- /dev/null
@@ -0,0 +1,15 @@
+from sys import path
+
+CONST = 42
+
+
+class MyClass:
+    pass
+
+
+def f():
+    def <caret>g():
+        f()
+        print(MyClass())
+        print(path)
+        print(CONST)
index c0da5618c7be7340d666c9e062967ef6c124fcfb..9101c80b77b660ca41aac93af943274d12c02013 100644 (file)
@@ -210,6 +210,10 @@ public class PyMakeFunctionTopLevelTest extends PyTestCase {
     doMultiFileTest("util.py", null);
   }
 
+  public void testLocalFunctionMoveToOtherFile() throws IOException {
+    doMultiFileTest("util.py", null);
+  }
+
   public void testMethodCalledViaClass() {
     doTestSuccess();
   }