⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pythoncompletionstringstest.java

📁 Python Development Environment (Python IDE plugin for Eclipse). Features editor, code completion, re
💻 JAVA
字号:
package org.python.pydev.editor.codecompletion;

import org.python.pydev.editor.codecompletion.revisited.CodeCompletionTestsBase;
import org.python.pydev.editor.codecompletion.revisited.modules.CompiledModule;

public class PythonCompletionStringsTest  extends CodeCompletionTestsBase {
    public static void main(String[] args) {

        try {
            // DEBUG_TESTS_BASE = true;
            PythonCompletionStringsTest test = new PythonCompletionStringsTest();
            test.setUp();
            test.test1();
            test.tearDown();
            System.out.println("Finished");

            junit.textui.TestRunner.run(PythonCompletionStringsTest.class);
        } catch (Exception e) {
            e.printStackTrace();
        } catch (Error e) {
            e.printStackTrace();
        }
    }

    /*
     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
        CompiledModule.COMPILED_MODULES_ENABLED = false;
        this.restorePythonPath(false);
        codeCompletion = new PyStringCodeCompletion();
    }

    /*
     * @see TestCase#tearDown()
     */
    protected void tearDown() throws Exception {
        CompiledModule.COMPILED_MODULES_ENABLED = true;
        super.tearDown();
    }
    

	public void test1() throws Exception {
        String doc = "" +
        "def m1(foo, bar):\n" +
        "   '''\n" +
        "   @param \n" +
        "   '''"; //<- bring tokens that are already defined in the local
        
        
        String[] toks = new String[]{"bar", "foo"};
        requestCompl(doc, doc.length()-"\n   '''".length(), toks.length, toks); //request right after the params
	}
	
	public void test2() throws Exception {
	    String doc = "" +
	    "def m1(foo, bar):\n" +
	    "   '''\n" +
	    "   @\n" +
	    "   '''"; //<- bring tokens that are already defined in the local
	    
	    
	    String[] toks = new String[]{"param", "type"};
	    requestCompl(doc, doc.length()-"\n   '''".length(), -1, toks); //request right after the params
        
        
	}
	
	public void test3() throws Exception {
	    String doc = "" +
	    "def m1(foo, bar):\n" +
	    "   '''\n" +
	    "   @para\n" +
	    "   '''"; //<- bring tokens that are already defined in the local
	    
	    
	    String[] toks = new String[]{"param"};
	    requestCompl(doc, doc.length()-"\n   '''".length(), -1, toks); //request right after the params
	}
	
	
	public void test4() throws Exception {
		String doc = "" +
		"class foo(object):\n" +
		"    \n" +
		"    def m1(self, create2, bar2):\n" +
		"        pass\n" +
		"    def m1(self, create, bar):\n" +
		"        '''\n" +
		"            @param cr\n" +
		"        '''\n"; 
		
		
		String[] toks = new String[]{"create"};
		requestCompl(doc, doc.length()-"\n        '''\n".length(), 1, toks); //request right after the params
	}
	
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -