mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Added runWithLanguageLevel() for Python testes
This commit is contained in:
@@ -27,6 +27,7 @@ import com.jetbrains.python.psi.LanguageLevel;
|
||||
import com.jetbrains.python.psi.PyFile;
|
||||
import com.jetbrains.python.psi.impl.PyFileImpl;
|
||||
import com.jetbrains.python.psi.impl.PythonLanguageLevelPusher;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -89,6 +90,16 @@ public abstract class PyTestCase extends UsefulTestCase {
|
||||
PythonLanguageLevelPusher.setForcedLanguageLevel(myFixture.getProject(), languageLevel);
|
||||
}
|
||||
|
||||
protected void runWithLanguageLevel(@NotNull LanguageLevel languageLevel, @NotNull Runnable action) {
|
||||
setLanguageLevel(languageLevel);
|
||||
try {
|
||||
action.run();
|
||||
}
|
||||
finally {
|
||||
setLanguageLevel(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected static void assertNotParsed(PyFile file) {
|
||||
assertNull(PARSED_ERROR_MSG, ((PyFileImpl)file).getTreeElement());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user