IJOB-583 PyCharm onboarding lesson broken (at step 16)

After PY-55548 no need to change type hint `object` to `float`


(cherry picked from commit d9ba34fb955df644b7892b070dc1f5523db7fce9)

IJ-CR-152255

GitOrigin-RevId: ae0f12168de11265c14432709abb074d35530ccc
This commit is contained in:
Andrey Vokin
2024-12-20 11:41:20 +01:00
committed by intellij-monorepo-bot
parent 3b13bba0dd
commit 915ccaa68e
2 changed files with 6 additions and 20 deletions

View File

@@ -53,7 +53,7 @@ python.onboarding.select.fix=Apply the first item: {0}. With this fix, your code
python.onboarding.invoke.intention.for.code=Intentions also save your time and make coding easier. Let''s use an intention to quickly add a return type for {0}. Press {1}.
python.onboarding.invoke.intention.for.code.balloon=Press {0} to show available intentions
python.onboarding.apply.intention=Select {0} and press {1}.
python.onboarding.complete.template=Type {0} and then press {1}.
python.onboarding.complete.template=Press {0}.
python.onboarding.invoke.search.everywhere.1=While working in <ide/>, you might want to search for files in your project, symbols, classes, or even IDE actions. In this lesson, let''s search for the {0} action to make the {1} string low-case.
python.onboarding.invoke.search.everywhere.2=Press {0} two times to open the {1} dialog.
python.onboarding.search.everywhere.description=As you can see, the selected text, {0}, has been automatically copied into the input string. Let''s type {1} instead of {0}.

View File

@@ -43,7 +43,6 @@ import com.jetbrains.python.sdk.pythonSdk
import training.dsl.*
import training.dsl.LessonUtil.adjustSearchEverywherePosition
import training.dsl.LessonUtil.checkEditorModification
import training.dsl.LessonUtil.checkExpectedStateOfEditor
import training.dsl.LessonUtil.restoreIfModified
import training.dsl.LessonUtil.restoreIfModifiedOrMoved
import training.dsl.LessonUtil.restorePopupPosition
@@ -89,9 +88,7 @@ class PythonOnboardingTourLesson :
val sample: LessonSample = parseLessonSample("""
def find_average(values)<caret id=3/>:
result = 0
for v in values:
result += v
result = sum(values)
<caret>return result<caret id=2/>
@@ -493,31 +490,20 @@ class PythonOnboardingTourLesson :
}
task {
text(PythonLessonsBundle.message("python.onboarding.apply.intention", strong(returnTypeMessage(project)), LessonUtil.rawEnter()))
text(PythonLessonsBundle.message("python.onboarding.apply.intention", strong(returnTypeMessage(project)), LessonUtil.rawEnter(), LessonUtil.rawEnter()))
stateCheck {
val text = editor.document.text
previous.sample.text != text && text.contains("object") && !text.contains("values: object")
previous.sample.text != text && text.contains("float") && !text.contains("values: object")
}
restoreByUi(delayMillis = defaultRestoreDelay)
}
task {
lateinit var forRestore: LessonSample
before {
val text = previous.sample.text
val toReplace = "object"
forRestore = LessonSample(text.replace(toReplace, ""), text.indexOf(toReplace).takeIf { it != -1 } ?: 0)
}
text(PythonLessonsBundle.message("python.onboarding.complete.template", code("float"), LessonUtil.rawEnter()))
text(PythonLessonsBundle.message("python.onboarding.complete.template", LessonUtil.rawEnter()))
stateCheck {
// TODO: make normal check
val activeTemplate = TemplateManagerImpl.getInstance(project).getActiveTemplate(editor)
editor.document.text.contains("float") && activeTemplate == null
}
proposeRestore {
checkExpectedStateOfEditor(forRestore) {
"object".contains(it) || "float".contains(it)
}
activeTemplate == null
}
}
}