From 652031862ccb0b87ad32e573c804896bbb98e6c1 Mon Sep 17 00:00:00 2001 From: Valentina Kiryushkina Date: Tue, 26 Jan 2016 19:22:58 +0300 Subject: [PATCH] Remove intellij edu plugins, obsolete tests and unused dependencies --- .../resources/META-INF/plugin.xml | 43 ---- .../src/EduProjectTemplate.java | 28 --- .../src/EduProjectTemplateFactory.java | 20 -- .../student-intellij/student-intellij.iml | 17 -- .../course-creator-intellij-py.iml | 25 --- .../resources/META-INF/plugin.xml | 39 ---- .../src/PyCCEduProjectTemplate.java | 92 --------- .../course-creator-python.iml | 5 +- .../testData/helloworld.py | 3 - .../testData/helloworld.xml | 86 -------- .../tests/CCTestCase.java | 31 --- .../educational-python/educational-python.iml | 1 - .../resources/META-INF/plugin.xml | 39 ---- .../fileTemplates/internal/test_helper.py.ft | 195 ------------------ .../src/PyEduProjectTemplate.java | 112 ---------- .../student-intellij-py.iml | 24 --- .../student-python/student-python.iml | 8 +- .../student-python/testData/course.json | 130 ------------ .../student-python/testData/helloworld.py | 1 - .../student-python/tests/JsonParserTest.java | 40 ---- .../tests/StudyDocumentListenerTest.java | 49 ----- .../student-python/tests/StudyTestCase.java | 33 --- 22 files changed, 3 insertions(+), 1018 deletions(-) delete mode 100644 python/educational-core/student-intellij/resources/META-INF/plugin.xml delete mode 100644 python/educational-core/student-intellij/src/EduProjectTemplate.java delete mode 100644 python/educational-core/student-intellij/src/EduProjectTemplateFactory.java delete mode 100644 python/educational-core/student-intellij/student-intellij.iml delete mode 100644 python/educational-python/course-creator-intellij-py/course-creator-intellij-py.iml delete mode 100644 python/educational-python/course-creator-intellij-py/resources/META-INF/plugin.xml delete mode 100644 python/educational-python/course-creator-intellij-py/src/PyCCEduProjectTemplate.java delete mode 100644 python/educational-python/course-creator-python/testData/helloworld.py delete mode 100644 python/educational-python/course-creator-python/testData/helloworld.xml delete mode 100644 python/educational-python/course-creator-python/tests/CCTestCase.java delete mode 100644 python/educational-python/student-intellij-py/resources/META-INF/plugin.xml delete mode 100644 python/educational-python/student-intellij-py/resources/fileTemplates/internal/test_helper.py.ft delete mode 100644 python/educational-python/student-intellij-py/src/PyEduProjectTemplate.java delete mode 100644 python/educational-python/student-intellij-py/student-intellij-py.iml delete mode 100644 python/educational-python/student-python/testData/course.json delete mode 100644 python/educational-python/student-python/testData/helloworld.py delete mode 100644 python/educational-python/student-python/tests/JsonParserTest.java delete mode 100644 python/educational-python/student-python/tests/StudyDocumentListenerTest.java delete mode 100644 python/educational-python/student-python/tests/StudyTestCase.java diff --git a/python/educational-core/student-intellij/resources/META-INF/plugin.xml b/python/educational-core/student-intellij/resources/META-INF/plugin.xml deleted file mode 100644 index 9f411d5788a7..000000000000 --- a/python/educational-core/student-intellij/resources/META-INF/plugin.xml +++ /dev/null @@ -1,43 +0,0 @@ - - com.jetbrains.edu.student.intellij - Educational plugin for Intellij - 2.0 - - - JetBrains - - - - - com.jetbrains.edu.student - - - - com.intellij.modules.lang - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python/educational-core/student-intellij/src/EduProjectTemplate.java b/python/educational-core/student-intellij/src/EduProjectTemplate.java deleted file mode 100644 index 56823c72d942..000000000000 --- a/python/educational-core/student-intellij/src/EduProjectTemplate.java +++ /dev/null @@ -1,28 +0,0 @@ -import com.intellij.ide.util.projectWizard.WizardInputField; -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.platform.ProjectTemplate; - -import javax.swing.*; - -public abstract class EduProjectTemplate implements ProjectTemplate { - public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.jetbrains.edu.interactivelearning.intellij.EduProjectTemplate"); - - public static WizardInputField createWizardInputField(String id, final String label, final JComponent component) { - return new WizardInputField(id, id) { - @Override - public String getLabel() { - return label; - } - - @Override - public JComponent getComponent() { - return component; - } - - @Override - public String getValue() { - return null; - } - }; - } -} diff --git a/python/educational-core/student-intellij/src/EduProjectTemplateFactory.java b/python/educational-core/student-intellij/src/EduProjectTemplateFactory.java deleted file mode 100644 index 83df2c5304b9..000000000000 --- a/python/educational-core/student-intellij/src/EduProjectTemplateFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -import com.intellij.ide.util.projectWizard.WizardContext; -import com.intellij.platform.ProjectTemplate; -import com.intellij.platform.ProjectTemplatesFactory; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class EduProjectTemplateFactory extends ProjectTemplatesFactory { - - @NotNull - @Override - public String[] getGroups() { - return new String[] {"Edu"}; - } - - @NotNull - @Override - public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) { - return EduProjectTemplate.EP_NAME.getExtensions(); - } -} \ No newline at end of file diff --git a/python/educational-core/student-intellij/student-intellij.iml b/python/educational-core/student-intellij/student-intellij.iml deleted file mode 100644 index b792842776ba..000000000000 --- a/python/educational-core/student-intellij/student-intellij.iml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python/educational-python/course-creator-intellij-py/course-creator-intellij-py.iml b/python/educational-python/course-creator-intellij-py/course-creator-intellij-py.iml deleted file mode 100644 index 2981c35b2c2e..000000000000 --- a/python/educational-python/course-creator-intellij-py/course-creator-intellij-py.iml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python/educational-python/course-creator-intellij-py/resources/META-INF/plugin.xml b/python/educational-python/course-creator-intellij-py/resources/META-INF/plugin.xml deleted file mode 100644 index ec28650f8b3e..000000000000 --- a/python/educational-python/course-creator-intellij-py/resources/META-INF/plugin.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - com.jetbrains.edu.coursecreator.intellij.python - Plugin for Intellij IDEA for creating python courses - 2.0 - - - JetBrains - - - - - com.intellij.modules.lang - com.intellij.modules.python - com.jetbrains.edu.student.intellij - com.jetbrains.edu.coursecreator - com.jetbrains.edu.coursecreator.python - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python/educational-python/course-creator-intellij-py/src/PyCCEduProjectTemplate.java b/python/educational-python/course-creator-intellij-py/src/PyCCEduProjectTemplate.java deleted file mode 100644 index 70e622108fab..000000000000 --- a/python/educational-python/course-creator-intellij-py/src/PyCCEduProjectTemplate.java +++ /dev/null @@ -1,92 +0,0 @@ -import com.intellij.ide.util.projectWizard.AbstractModuleBuilder; -import com.intellij.ide.util.projectWizard.WizardInputField; -import com.intellij.openapi.module.ModifiableModuleModel; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.ModifiableRootModel; -import com.intellij.openapi.startup.StartupManager; -import com.intellij.openapi.ui.ValidationInfo; -import com.intellij.openapi.vfs.VirtualFile; -import com.jetbrains.edu.coursecreator.PyCCProjectGenerator; -import com.jetbrains.edu.coursecreator.ui.CCNewProjectPanel; -import com.jetbrains.python.facet.PythonSdkComboBox; -import com.jetbrains.python.module.PythonModuleBuilder; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.util.ArrayList; -import java.util.List; - -public class PyCCEduProjectTemplate extends EduProjectTemplate { - - @NotNull - @Override - public String getName() { - return "Python Course Creation"; - } - - @Override - public String getDescription() { - return null; - } - - @Override - public Icon getIcon() { - return null; - } - - @NotNull - @Override - public AbstractModuleBuilder createModuleBuilder() { - return new PythonEduModuleBuilder() ; - } - - @Override - public ValidationInfo validateSettings() { - return null; - } - - private static class PythonEduModuleBuilder extends PythonModuleBuilder { - @Override - public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException { - super.setupRootModel(rootModel); - Sdk sdk = mySdkComboBox.getSelectedSdk(); - if (sdk != null) { - rootModel.setSdk(sdk); - } - } - - final PythonSdkComboBox mySdkComboBox = new PythonSdkComboBox(); - final CCNewProjectPanel panel = new CCNewProjectPanel(); - - - @Override - protected List getAdditionalFields() { - List wizardInputFields = new ArrayList(); - wizardInputFields.add(createWizardInputField("Edu.CCProjectSdk", "Python Interpreter:", mySdkComboBox)); - wizardInputFields.add(createWizardInputField("Edu.Author", "Author:", panel.getAuthorField())); - wizardInputFields.add(createWizardInputField("Edu.Name", "Name:", panel.getNameField())); - wizardInputFields.add(createWizardInputField("Edu.Description", "Description:", panel.getDescriptionField())); - return wizardInputFields; - } - - @Nullable - @Override - public Module commitModule(@NotNull final Project project, @Nullable ModifiableModuleModel model) { - Module module = super.commitModule(project, model); - if (module != null) { - final VirtualFile baseDir = project.getBaseDir(); - StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() { - @Override - public void run() { - PyCCProjectGenerator.generateProject(project, baseDir, panel.getName(), panel.getAuthors(), panel.getDescription()); - } - }); - } - return module; - } - } -} diff --git a/python/educational-python/course-creator-python/course-creator-python.iml b/python/educational-python/course-creator-python/course-creator-python.iml index 9de5f2170fbd..51499938c1e2 100644 --- a/python/educational-python/course-creator-python/course-creator-python.iml +++ b/python/educational-python/course-creator-python/course-creator-python.iml @@ -11,11 +11,8 @@ - - - - + \ No newline at end of file diff --git a/python/educational-python/course-creator-python/testData/helloworld.py b/python/educational-python/course-creator-python/testData/helloworld.py deleted file mode 100644 index c3bca7e8f0f2..000000000000 --- a/python/educational-python/course-creator-python/testData/helloworld.py +++ /dev/null @@ -1,3 +0,0 @@ -print("Hello world") -print("Hello world") -print("Hello world") \ No newline at end of file diff --git a/python/educational-python/course-creator-python/testData/helloworld.xml b/python/educational-python/course-creator-python/testData/helloworld.xml deleted file mode 100644 index 3b37c6941c25..000000000000 --- a/python/educational-python/course-creator-python/testData/helloworld.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - \ No newline at end of file diff --git a/python/educational-python/course-creator-python/tests/CCTestCase.java b/python/educational-python/course-creator-python/tests/CCTestCase.java deleted file mode 100644 index 870dfc57adae..000000000000 --- a/python/educational-python/course-creator-python/tests/CCTestCase.java +++ /dev/null @@ -1,31 +0,0 @@ -import com.intellij.testFramework.UsefulTestCase; -import com.intellij.testFramework.fixtures.CodeInsightTestFixture; -import com.intellij.testFramework.fixtures.IdeaProjectTestFixture; -import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory; -import com.intellij.testFramework.fixtures.TestFixtureBuilder; -import com.jetbrains.python.PythonHelpersLocator; - -public abstract class CCTestCase extends UsefulTestCase { - protected CodeInsightTestFixture myFixture; - - @Override - protected void setUp() throws Exception { - super.setUp(); - final TestFixtureBuilder projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder( - getName()); - myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture()); - myFixture.setUp(); - myFixture.setTestDataPath(getTestDataPath()); - } - - protected String getTestDataPath() { - return PythonHelpersLocator.getPythonCommunityPath() + "/edu/course-creator-python/testData"; - } - - @Override - protected void tearDown() throws Exception { - myFixture.tearDown(); - myFixture = null; - super.tearDown(); - } -} diff --git a/python/educational-python/educational-python.iml b/python/educational-python/educational-python.iml index 9deb15033467..5832d9d1b31a 100644 --- a/python/educational-python/educational-python.iml +++ b/python/educational-python/educational-python.iml @@ -10,7 +10,6 @@ - diff --git a/python/educational-python/student-intellij-py/resources/META-INF/plugin.xml b/python/educational-python/student-intellij-py/resources/META-INF/plugin.xml deleted file mode 100644 index bcc53a0ac2cf..000000000000 --- a/python/educational-python/student-intellij-py/resources/META-INF/plugin.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - com.jetbrains.edu.student.intellij.python - Educational plugin for Intellij Python - 2.0 - - - JetBrains - - - - - com.intellij.modules.lang - com.intellij.modules.python - com.jetbrains.edu.student - com.jetbrains.python.edu.student.python - com.jetbrains.edu.student.intellij - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python/educational-python/student-intellij-py/resources/fileTemplates/internal/test_helper.py.ft b/python/educational-python/student-intellij-py/resources/fileTemplates/internal/test_helper.py.ft deleted file mode 100644 index ca61ba52f459..000000000000 --- a/python/educational-python/student-intellij-py/resources/fileTemplates/internal/test_helper.py.ft +++ /dev/null @@ -1,195 +0,0 @@ -import sys - - -def get_file_text(path): - """ Returns file text by path""" - file_io = open(path, "r") - text = file_io.read() - file_io.close() - return text - - -def get_file_output(encoding="utf-8", path=sys.argv[-1]): - """ - Returns answer file output - :param encoding: to decode output in python3 - :param path: path of file to execute - :return: list of strings - """ - import subprocess - - proc = subprocess.Popen([sys.executable, path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - return list(map(lambda x: str(x.decode(encoding)), proc.communicate()[0].splitlines())) - - -def test_file_importable(): - """ Tests there is no obvious syntax errors""" - path = sys.argv[-1] - if not path.endswith(".py"): - import os - - parent = os.path.abspath(os.path.join(path, os.pardir)) - python_files = [f for f in os.listdir(parent) if os.path.isfile(os.path.join(parent, f)) and f.endswith(".py")] - for python_file in python_files: - if python_file == "tests.py": continue - check_importable_path(os.path.join(parent, python_file)) - return - check_importable_path(path) - - -def check_importable_path(path): - """ Checks that file is importable. - Reports failure otherwise. - """ - try: - import_file(path) - except: - failed("The file contains syntax errors", test_file_importable.__name__) - return - passed(test_file_importable.__name__) - - -def import_file(path): - """ Returns imported file """ - if sys.version_info[0] == 2 or sys.version_info[1] < 3: - import imp - - return imp.load_source("tmp", path) - elif sys.version_info[0] == 3: - import importlib.machinery - - return importlib.machinery.SourceFileLoader("tmp", path).load_module("tmp") - - -def import_task_file(): - """ Returns imported file. - Imports file from which check action was run - """ - path = sys.argv[-1] - return import_file(path) - - -def test_is_not_empty(): - """ - Checks that file is not empty - """ - path = sys.argv[-1] - file_text = get_file_text(path) - - if len(file_text) > 0: - passed() - else: - failed("The file is empty. Please, reload the task and try again.") - - -def test_is_initial_text(error_text="You should modify the file"): - """ - Checks that file was modified - """ - path = sys.argv[-1] - text = get_initial_text(path) - file_text = get_file_text(path) - - if file_text.strip() == text: - failed(error_text) - else: - passed() - - -def get_initial_text(path): - """ - Returns the initial task text - """ - course_lib = sys.argv[-2] - - import os - # path format is "project_root/lessonX/taskY/file.py" - task_index = path.rfind(os.sep, 0, path.rfind(os.sep)) - index = path.rfind(os.sep, 0, task_index) - relative_path = path[index + 1:] - initial_file_path = os.path.join(course_lib, relative_path) - return get_file_text(initial_file_path) - - -def test_text_equals(text, error_text): - """ - Checks that answer equals text. - """ - path = sys.argv[-1] - file_text = get_file_text(path) - - if file_text.strip() == text: - passed() - else: - failed(error_text) - - -def test_answer_placeholders_text_deleted(error_text="Don't just delete task text"): - """ - Checks that all answer placeholders are not empty - """ - windows = get_answer_placeholders() - - for window in windows: - if len(window) == 0: - failed(error_text) - return - passed() - - -def set_congratulation_message(message): - """ Overrides default 'Congratulations!' message """ - print("#educational_plugin CONGRATS_MESSAGE " + message) - - -def failed(message="Please, reload the task and try again.", name=None): - """ Reports failure """ - if not name: - name = sys._getframe().f_back.f_code.co_name - print("#educational_plugin " + name + " FAILED + " + message) - - -def passed(name=None): - """ Reports success """ - if not name: - name = sys._getframe().f_back.f_code.co_name - print("#educational_plugin " + name + " test OK") - - -def get_answer_placeholders(): - """ - Returns all answer placeholders text - """ - prefix = "#educational_plugin_window = " - path = sys.argv[-1] - import os - - file_name_without_extension = os.path.splitext(path)[0] - windows_path = file_name_without_extension + "_windows" - windows = [] - f = open(windows_path, "r") - window_text = "" - first = True - for line in f.readlines(): - if line.startswith(prefix): - if not first: - windows.append(window_text.strip()) - else: - first = False - window_text = line[len(prefix):] - else: - window_text += line - - if window_text: - windows.append(window_text.strip()) - - f.close() - return windows - - -def run_common_tests(error_text="Please, reload file and try again"): - test_is_initial_text() - test_is_not_empty() - test_answer_placeholders_text_deleted() - test_file_importable() - diff --git a/python/educational-python/student-intellij-py/src/PyEduProjectTemplate.java b/python/educational-python/student-intellij-py/src/PyEduProjectTemplate.java deleted file mode 100644 index ea8e39b0117f..000000000000 --- a/python/educational-python/student-intellij-py/src/PyEduProjectTemplate.java +++ /dev/null @@ -1,112 +0,0 @@ -import com.intellij.ide.fileTemplates.FileTemplate; -import com.intellij.ide.fileTemplates.FileTemplateManager; -import com.intellij.ide.fileTemplates.FileTemplateUtil; -import com.intellij.ide.util.projectWizard.AbstractModuleBuilder; -import com.intellij.ide.util.projectWizard.WizardInputField; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.module.ModifiableModuleModel; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.ModifiableRootModel; -import com.intellij.openapi.startup.StartupManager; -import com.intellij.openapi.ui.ValidationInfo; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.PsiDirectory; -import com.intellij.psi.PsiManager; -import com.jetbrains.edu.learning.courseGeneration.StudyProjectGenerator; -import com.jetbrains.edu.learning.ui.StudyNewProjectPanel; -import com.jetbrains.python.facet.PythonSdkComboBox; -import com.jetbrains.python.module.PythonModuleBuilder; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.util.ArrayList; -import java.util.List; - -public class PyEduProjectTemplate extends EduProjectTemplate { - private static final Logger LOG = Logger.getInstance(PyEduProjectTemplate.class); - - @NotNull - @Override - public String getName() { - return "Python"; - } - - @Nullable - @Override - public String getDescription() { - return null; - } - - @Override - public Icon getIcon() { - return null; - } - - @NotNull - @Override - public AbstractModuleBuilder createModuleBuilder() { - return new PythonEduModuleBuilder(); - } - - @Nullable - @Override - public ValidationInfo validateSettings() { - return null; - } - - private static class PythonEduModuleBuilder extends PythonModuleBuilder { - - final StudyProjectGenerator studyProjectGenerator = new StudyProjectGenerator(); - final PythonSdkComboBox mySdkComboBox = new PythonSdkComboBox(); - - @Override - public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException { - super.setupRootModel(rootModel); - Sdk sdk = mySdkComboBox.getSelectedSdk(); - if (sdk != null) { - rootModel.setSdk(sdk); - } - } - - @Override - protected List getAdditionalFields() { - final StudyNewProjectPanel panel = new StudyNewProjectPanel(studyProjectGenerator); - List wizardInputFields = new ArrayList(); - wizardInputFields.add(createWizardInputField("Edu.ProjectSdk", "Python Interpreter:", mySdkComboBox)); - wizardInputFields.add(createWizardInputField("Edu.Courses", "Courses:", panel.getCoursesComboBox())); - wizardInputFields.add(createWizardInputField("Edu.InfoPanel", "", panel.getInfoPanel())); - return wizardInputFields; - } - - @Nullable - @Override - public Module commitModule(@NotNull final Project project, @Nullable ModifiableModuleModel model) { - Module module = super.commitModule(project, model); - if (module != null) { - final VirtualFile baseDir = project.getBaseDir(); - studyProjectGenerator.generateProject(project, baseDir); - final FileTemplate template = FileTemplateManager.getInstance(project).getInternalTemplate("test_helper.py"); - - StartupManager.getInstance(project).runWhenProjectIsInitialized(new Runnable() { - @Override - public void run() { - final PsiDirectory projectDir = PsiManager.getInstance(project).findDirectory(baseDir); - if (projectDir != null) { - try { - FileTemplateUtil.createFromTemplate(template, "test_helper.py", null, projectDir); - } - catch (Exception e) { - LOG.error("Failed to create test_helper", e); - } - } - } - }); - } - return module; - } - } -} \ No newline at end of file diff --git a/python/educational-python/student-intellij-py/student-intellij-py.iml b/python/educational-python/student-intellij-py/student-intellij-py.iml deleted file mode 100644 index 5cfece09b5f6..000000000000 --- a/python/educational-python/student-intellij-py/student-intellij-py.iml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/python/educational-python/student-python/student-python.iml b/python/educational-python/student-python/student-python.iml index be50eec7386c..a86df8f4893f 100644 --- a/python/educational-python/student-python/student-python.iml +++ b/python/educational-python/student-python/student-python.iml @@ -11,15 +11,11 @@ - - - - - - + + \ No newline at end of file diff --git a/python/educational-python/student-python/testData/course.json b/python/educational-python/student-python/testData/course.json deleted file mode 100644 index bff570afd29a..000000000000 --- a/python/educational-python/student-python/testData/course.json +++ /dev/null @@ -1,130 +0,0 @@ -{ - "name": "Python для начинающих", - "description": "Начальный курс по языку Python", - "lessons": [ - { - "name": "Первые программа", - "task_list": [ - { - "name": "Задание 1", - "text": "hello-text.html", - "test_file": "hello-tests.py", - "test_num": 1, - "task_files": { - "helloworld.py": { - "task_windows": [ - { - "line": 0, - "start": 0, - "text": "type operator", - "hint": "hello-text.html", - "possible_answer": "print" - }, - { - "line": 0, - "start": 33, - "text": "type your name", - "hint": "empty_study.docs", - "possible_answer": "Liana" - } - ] - } - } - }, - { - "name": "Задание 2", - "text": "matchends-text.html", - "test_file": "matchends-test.py", - "test_num": 3, - "task_files": { - "match_ends.py": { - "task_windows": [ - { - "line": 1, - "start": 43, - "text": "condition", - "hint": "empty_study.docs", - "possible_answer": ">=" - }, - { - "line": 1, - "start": 61, - "text": "index", - "hint": "empty_study.docs", - "possible_answer": "0" - }, - { - "line": 1, - "start": 73, - "text": "index", - "hint": "empty_study.docs", - "possible_answer": "-1" - }, - { - "line": 2, - "start": 11, - "text": "function", - "hint": "list.docs", - "possible_answer": "len" - } - ] - } - } - } - ] - }, - { - "name": "Простые задачи", - "task_list": [ - { - "name": "Задание 1", - "text": "sum-text.html", - "test_file": "sum_tests.py", - "test_num": 3, - "user_tests": [ - { - "input": "sum-input.txt", - "output": "sum-output" - } - ], - "task_files": { - "sum.py": { - "task_windows": [ - { - "line": 4, - "start": 15, - "text": "получите из консоли имя файла", - "hint": "argv.docs", - "possible_answer": "sys.argv[1]" - }, - { - "line": 5, - "start": 8, - "text": "откройте файл на запись", - "hint": "empty_study.docs", - "possible_answer": "open(filename, 'r')" - }, - { - "line": 10, - "start": 4, - "text": "закройте файл", - "hint": "empty_study.docs", - "possible_answer": "f.close()" - }, - { - "line": 11, - "start": 14, - "text": "правильно проинициализируйте значение", - "hint": "empty_study.docs", - "possible_answer": "-sys.maxint" - } - ] - } - } - } - - ] - - } - ] -} \ No newline at end of file diff --git a/python/educational-python/student-python/testData/helloworld.py b/python/educational-python/student-python/testData/helloworld.py deleted file mode 100644 index 71aef58a5053..000000000000 --- a/python/educational-python/student-python/testData/helloworld.py +++ /dev/null @@ -1 +0,0 @@ -type operator("Hello, world! My name is type your name") \ No newline at end of file diff --git a/python/educational-python/student-python/tests/JsonParserTest.java b/python/educational-python/student-python/tests/JsonParserTest.java deleted file mode 100644 index 42ac11d1eb37..000000000000 --- a/python/educational-python/student-python/tests/JsonParserTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.jetbrains.edu.learning; - -import com.google.gson.FieldNamingPolicy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.jetbrains.edu.courseFormat.Course; -import com.jetbrains.python.PythonHelpersLocator; -import junit.framework.TestCase; - -import java.io.FileInputStream; -import java.io.InputStreamReader; -import java.io.Reader; - - -/** - * author: liana - * data: 7/4/14. - */ -public class JsonParserTest extends TestCase { - private Course myCourse = null; - - public void setUp() throws Exception { - super.setUp(); - Reader reader = new InputStreamReader(new FileInputStream(getTestDataPath() + "/course.json")); - Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); - myCourse = gson.fromJson(reader, Course.class); - } - - public void testCourseLevel() { - assertEquals(myCourse.getName(), "Python для начинающих"); - - //assertEquals(StudyUtils.getFirst(myCourse.getLessons().get(1).getTaskList().get(0).getUserTests()).getInput(), "sum-input.txt"); - assertEquals(myCourse.getLessons().size(), 2); - assertEquals(myCourse.getLessons().get(0).getTaskList().size(), 2); - assertEquals(myCourse.getLessons().get(1).getTaskList().size(), 1); - } - protected String getTestDataPath() { - return PythonHelpersLocator.getPythonCommunityPath() + "/edu/interactive-learning-python/testData"; - } -} diff --git a/python/educational-python/student-python/tests/StudyDocumentListenerTest.java b/python/educational-python/student-python/tests/StudyDocumentListenerTest.java deleted file mode 100644 index 996536f4bf7b..000000000000 --- a/python/educational-python/student-python/tests/StudyDocumentListenerTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.jetbrains.edu.learning; - -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.command.CommandProcessor; -import com.intellij.openapi.editor.Document; -import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.psi.PsiFile; -import com.jetbrains.edu.EduDocumentListener; -import com.jetbrains.edu.courseFormat.AnswerPlaceholder; -import com.jetbrains.edu.courseFormat.TaskFile; - -import java.util.ArrayList; -import java.util.List; - -public class StudyDocumentListenerTest extends StudyTestCase { - - public void testTaskWindowSimpleUpdate() throws Exception { - PsiFile psiFile = myFixture.configureByFile("helloworld.py"); - final Document document = myFixture.getDocument(psiFile); - - TaskFile taskFile = new TaskFile(); - List answerPlaceholders = new ArrayList(); - addTaskWindow(answerPlaceholders, 0, 32, 14); - taskFile.setAnswerPlaceholders(answerPlaceholders); - EduDocumentListener listener = new EduDocumentListener(taskFile); - document.addDocumentListener(listener); - CommandProcessor.getInstance().executeCommand(myFixture.getProject(), new Runnable() { - @Override - public void run() { - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - document.insertString(0, "text"); - FileDocumentManager.getInstance().saveDocument(document); - } - }); - } - }, "x", "qwe"); - assertEquals(answerPlaceholders.get(0).getRealStartOffset(document), 36); - } - - private static void addTaskWindow(List answerPlaceholders, int line, int start, int length) { - AnswerPlaceholder answerPlaceholder = new AnswerPlaceholder(); - answerPlaceholder.setLine(line); - answerPlaceholder.setStart(start); - answerPlaceholder.setLength(length); - answerPlaceholders.add(answerPlaceholder); - } -} diff --git a/python/educational-python/student-python/tests/StudyTestCase.java b/python/educational-python/student-python/tests/StudyTestCase.java deleted file mode 100644 index 631798d72c8e..000000000000 --- a/python/educational-python/student-python/tests/StudyTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.jetbrains.edu.learning; - -import com.intellij.testFramework.UsefulTestCase; -import com.intellij.testFramework.fixtures.CodeInsightTestFixture; -import com.intellij.testFramework.fixtures.IdeaProjectTestFixture; -import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory; -import com.intellij.testFramework.fixtures.TestFixtureBuilder; -import com.jetbrains.python.PythonHelpersLocator; - -public abstract class StudyTestCase extends UsefulTestCase { - protected CodeInsightTestFixture myFixture; - - @Override - protected void setUp() throws Exception { - super.setUp(); - final TestFixtureBuilder projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder( - getName()); - myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture()); - myFixture.setUp(); - myFixture.setTestDataPath(getTestDataPath()); - } - - protected String getTestDataPath() { - return PythonHelpersLocator.getPythonCommunityPath() + "/edu/interactive-learning-python/testData"; - } - - @Override - protected void tearDown() throws Exception { - myFixture.tearDown(); - myFixture = null; - super.tearDown(); - } -}