Package org.python.pydev.editor.refactoring

Examples of org.python.pydev.editor.refactoring.RefactoringRequest


    public void testSearch3() throws Exception {
        String line = "from testlib.unittest import testcase as t";
        //            "from testlib.unittest import test" < -- that's the cursor pos
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "testlib/unittest/anothertest.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), line.length() - 9);

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "testlib/unittest/testcase.py"), pointers[0].file);
View Full Code Here


    public void testSearch4() throws Exception {
        String line = "from testlib.unittest import testcase as t";
        //            "from testlib.unitt" < -- that's the cursor pos
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "testlib/unittest/anothertest.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), line.length() - 24);

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "testlib/unittest/__init__.py"), pointers[0].file);
View Full Code Here

    public void testSearch5() throws Exception {
        //ring line = "from testlib.unittest import testcase as t";
        //            "from " < -- that's the cursor pos
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "testlib/unittest/anothertest.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest("", file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), 6);

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "testlib/__init__.py"), pointers[0].file);
View Full Code Here

    public void testSearch6() throws Exception {
        //from testlib.unittest import testcase as t
        String line = "class AnotherTest(t.TestCase):";
        //            "from " < -- that's the cursor pos
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "testlib/unittest/anothertest.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), 2, line.length() - 5);

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "testlib/unittest/testcase.py"), pointers[0].file);
View Full Code Here

        //        class TestStaticExt(TestStatic):
        //            def __init__(self):
        //                print self.static1
        String line = "print TestStatic.static1";
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "extendable/static2.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), 1, line.length());

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "extendable/static.py"), pointers[0].file);
View Full Code Here

        //        class TestStaticExt(TestStatic):
        //            def __init__(self):
        //                print self.static1
        String line = "        print self.static1";
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "extendable/static2.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), 4, line.length());

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "extendable/static.py"), pointers[0].file);
View Full Code Here

        //            def __init__(self):
        //                print self.static1
        //              from extendable.dependencies.file2 import Test
        String line = "        from extendable.dependencies.file2 import Test";
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "extendable/static2.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), 5, line.length());

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "extendable/dependencies/file2.py"), pointers[0].file);
View Full Code Here

        //                print self.static1
        //                from extendable.dependencies.file2 import Test
        //                import extendable.dependencies.file2.Test
        String line = "        import extendable.dependencies.file2.Test";
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "extendable/static2.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), 6, line.length());

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "extendable/dependencies/file2.py"), pointers[0].file);
View Full Code Here

        //                print self.static1
        //                from extendable.dependencies.file2 import Test
        //                import extendable.dependencies.file2.Test
        String line = "        import extendable.dependencies.file2.Test";
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "extendable/static2.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), 6, line.length() - 7); //find the file2 module itself

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "extendable/dependencies/file2.py"), pointers[0].file);
View Full Code Here

        //                print self.static1
        //                from extendable.dependencies.file2 import Test
        //                import extendable.dependencies.file2.Test
        String line = "        import extendable.dependencies.file2.Test";
        final File file = new File(TestDependent.TEST_PYSRC_LOC + "extendable/static2.py");
        RefactoringRequest refactoringRequest = createRefactoringRequest(line, file);
        refactoringRequest.ps = new PySelection(refactoringRequest.getDoc(), 6, line.length() - 16); //find the dependencies module itself

        ItemPointer[] pointers = refactorer.findDefinition(refactoringRequest);

        assertEquals(1, pointers.length);
        assertEquals(new File(TestDependent.TEST_PYSRC_LOC + "extendable/dependencies/__init__.py"), pointers[0].file);
View Full Code Here

TOP

Related Classes of org.python.pydev.editor.refactoring.RefactoringRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.