diff --git a/plugins/org.python.pydev.core/tests/org/python/pydev/core/TestDependent.java b/plugins/org.python.pydev.core/tests/org/python/pydev/core/TestDependent.java index 6a6d9e47f4..efa9855f01 100644 --- a/plugins/org.python.pydev.core/tests/org/python/pydev/core/TestDependent.java +++ b/plugins/org.python.pydev.core/tests/org/python/pydev/core/TestDependent.java @@ -181,15 +181,21 @@ public static boolean isUnix() { // File is something as Pydev/plugins/org.python.pydev.core // We want something as: Pydev/plugins/ - file = file.getParentFile(); - if (new File(file, "org.python.pydev.core").exists()) { - TEST_PYDEV_BASE_LOC = file.toString().replace("\\", "/"); - if (!TEST_PYDEV_BASE_LOC.endsWith("/")) { - TEST_PYDEV_BASE_LOC += '/'; + for (int i = 0; i < 10; i++) { + file = file.getParentFile(); + File corePlugin = new File(file, "org.python.pydev.core"); + if (corePlugin.exists()) { + TEST_PYDEV_BASE_LOC = file.toString().replace("\\", "/"); + if (!TEST_PYDEV_BASE_LOC.endsWith("/")) { + TEST_PYDEV_BASE_LOC += '/'; + } + break; } - } else { + } + if (TEST_PYDEV_BASE_LOC == null) { System.err.println( - "TEST_PYDEV_BASE_LOC variable MUST be set in " + propertiesFile + " to run tests."); + "TEST_PYDEV_BASE_LOC variable MUST be set in " + propertiesFile + + " to run tests (unable to auto-discover value)."); } } else if (!new File(TEST_PYDEV_BASE_LOC).exists()) { @@ -234,6 +240,9 @@ public static boolean isUnix() { if (!TEST_PYSRC_TESTING_LOC.endsWith("/")) { throw new RuntimeException("Expecting TEST_PYSRC_TESTING_LOC to end with '/'"); } + if (!new File(TEST_PYSRC_TESTING_LOC).exists()) { + throw new RuntimeException("Expected TEST_PYSRC_TESTING_LOC: " + TEST_PYSRC_TESTING_LOC + " to exist!"); + } if (TEST_PYSRC_NAVIGATOR_LOC == null) { TEST_PYSRC_NAVIGATOR_LOC = TEST_PYDEV_BASE_LOC + "org.python.pydev/tests_navigator/pysrc/"; diff --git a/plugins/org.python.pydev.parser/tests/org/python/pydev/parser/PyParser312Test.java b/plugins/org.python.pydev.parser/tests/org/python/pydev/parser/PyParser312Test.java index 80432f83d7..b8f68c46d4 100644 --- a/plugins/org.python.pydev.parser/tests/org/python/pydev/parser/PyParser312Test.java +++ b/plugins/org.python.pydev.parser/tests/org/python/pydev/parser/PyParser312Test.java @@ -28,8 +28,17 @@ public void testFStrings() { + ""; // TODO: Support this! - // SimpleNode ast = parseLegalDocStr(s); + // parseLegalDocStr(s); } + public void testTypeVarSyntax() { + String s = """ + def f312[T](e: T) -> None: ... + print(f312) + """; + // TODO: Support this! + // parseLegalDocStr(s); + } + } diff --git a/plugins/org.python.pydev/tests_completions/org/python/pydev/ast/codecompletion/PythonCompletionWithoutBuiltinsTest.java b/plugins/org.python.pydev/tests_completions/org/python/pydev/ast/codecompletion/PythonCompletionWithoutBuiltinsTest.java index 1541b2db51..b3ff109f69 100644 --- a/plugins/org.python.pydev/tests_completions/org/python/pydev/ast/codecompletion/PythonCompletionWithoutBuiltinsTest.java +++ b/plugins/org.python.pydev/tests_completions/org/python/pydev/ast/codecompletion/PythonCompletionWithoutBuiltinsTest.java @@ -67,7 +67,7 @@ public static void main(String[] args) { //DEBUG_TESTS_BASE = true; PythonCompletionWithoutBuiltinsTest test = new PythonCompletionWithoutBuiltinsTest(); test.setUp(); - test.testGrammar2AbsoluteAndRelativeImports(); + test.testAnnotatedCompletion(); test.tearDown(); System.out.println("Finished"); @@ -3558,4 +3558,18 @@ public void testEnumCustom2() throws Exception { requestCompl(s, s.length(), -1, new String[] { "name", "value", "signal_type" }); } + public void testAnnotatedCompletion() throws Exception { + String s = """ + from typing import Annotated + + class C: + def method1(self) -> None: + pass + + def f2(c: Annotated[C, ...]) -> None: + c. + """.strip(); + requestCompl(s, s.length(), -1, new String[] { "method1()" }); + } + } \ No newline at end of file