[Pydev-cvs] org.python.pydev/tests/org/python/pydev/editor/codecompletion/revisited PythonPathHelper
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2005-02-14 11:51:32
|
Update of /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/codecompletion/revisited In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13079/tests/org/python/pydev/editor/codecompletion/revisited Modified Files: PythonPathHelperTest.java Log Message: import from as xxx should work now. Index: PythonPathHelperTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/codecompletion/revisited/PythonPathHelperTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PythonPathHelperTest.java 3 Feb 2005 12:31:14 -0000 1.3 --- PythonPathHelperTest.java 14 Feb 2005 11:51:23 -0000 1.4 *************** *** 31,40 **** public String sDoc = ""; - public static void main(String[] args) { - //IMPORTANT: I don't want to test the compiled modules, only the source modules. - CompiledModule.COMPILED_MODULES_ENABLED = false; - - junit.textui.TestRunner.run(PythonPathHelperTest.class); - } --- 31,34 ---- *************** *** 42,46 **** * @see junit.framework.TestCase#setUp() */ ! protected void setUp() throws Exception { super.setUp(); manager = new ASTManager(); --- 36,40 ---- * @see junit.framework.TestCase#setUp() */ ! public void setUp() throws Exception { super.setUp(); manager = new ASTManager(); *************** *** 48,51 **** --- 42,52 ---- manager.changePythonPath(PYTHON_INSTALL+"lib|"+TEST_PYSRC_LOC, null, new NullProgressMonitor()); } + + /** + * @see junit.framework.TestCase#tearDown() + */ + public void tearDown() throws Exception { + super.tearDown(); + } public void testResolvePath(){ *************** *** 158,160 **** --- 159,240 ---- ASTManagerTest.assertIsIn("another", comps); } + + public void testImportAs(){ + token = "t"; + line = 3; + col = 2; + + sDoc = ""+ + "from testlib import unittest as t \n"+ + " \n"+ + "t. \n"; + + IToken[] comps = null; + Document doc = new Document(sDoc); + CompletionState state = new CompletionState(line,col, token, nature); + comps = manager.getCompletionsForToken(doc, state); + assertEquals(6, comps.length); + + ASTManagerTest.assertIsIn("TestCase", comps); + ASTManagerTest.assertIsIn("main", comps); + ASTManagerTest.assertIsIn("TestCaseAlias", comps); + ASTManagerTest.assertIsIn("GUITest", comps); + ASTManagerTest.assertIsIn("testcase", comps); + ASTManagerTest.assertIsIn("AnotherTest", comps); + } + + public void testImportAs2(){ + token = "t"; + line = 3; + col = 2; + + sDoc = ""+ + "from testlib.unittest import AnotherTest as t \n"+ + " \n"+ + "t. \n"; + + IToken[] comps = null; + Document doc = new Document(sDoc); + CompletionState state = new CompletionState(line,col, token, nature); + comps = manager.getCompletionsForToken(doc, state); + assertTrue(comps.length > 5); + ASTManagerTest.assertIsIn("assertEquals", comps); + ASTManagerTest.assertIsIn("assertNotEquals", comps); + ASTManagerTest.assertIsIn("assertAlmostEquals", comps); + ASTManagerTest.assertIsIn("another", comps); + + } + + public static void main(String[] args) { + //IMPORTANT: I don't want to test the compiled modules, only the source modules. + CompiledModule.COMPILED_MODULES_ENABLED = false; + + junit.textui.TestRunner.run(PythonPathHelperTest.class); + // try { + // PythonPathHelperTest test = new PythonPathHelperTest(); + // test.setUp(); + // test.testImportAs2(); + // test.tearDown(); + // } catch (Exception e) { + // e.printStackTrace(); + // } catch(Error e){ + // e.printStackTrace(); + // } + } } + + + + + + + + + + + + + + + + |