void () { PyBlockEvaluator eval = new PyBlockEvaluator(); PyFile file = (PyFile)PsiFileFactory.getInstance(myFixture.getProject()) .createFileFromText("a.py", PythonFileType.INSTANCE, "def foo(): return 'a'"); PyFunction foo = file.findTopLevelFunction("foo"); eval.evaluate(foo); assertEquals("a", eval.getReturnValue()); }