mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 23:31:05 +07:00
PY-46321 Tests for Python and Python REPL in Markdown code fences
GitOrigin-RevId: f6d7f212c363f7852f69a4a54993b36774d9fed6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
eaefde3c09
commit
ac36f11225
@@ -5,6 +5,7 @@
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
@@ -12,5 +13,6 @@
|
||||
<orderEntry type="module" module-name="intellij.markdown" />
|
||||
<orderEntry type="module" module-name="intellij.python.psi.impl" />
|
||||
<orderEntry type="module" module-name="intellij.python.psi" />
|
||||
<orderEntry type="module" module-name="intellij.python.community.tests" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.jetbrains.python.markdown
|
||||
|
||||
import com.jetbrains.python.fixtures.PyTestCase
|
||||
|
||||
class PyCodeFenceTest : PyTestCase() {
|
||||
fun testPythonInjected() {
|
||||
myFixture.configureByText("a.md", """
|
||||
```python
|
||||
foo = 1
|
||||
f<caret>
|
||||
|
||||
```
|
||||
""".trimIndent())
|
||||
myFixture.completeBasic()
|
||||
assertContainsElements(lookupStrings, "foo")
|
||||
}
|
||||
|
||||
fun testPyInjected() {
|
||||
myFixture.configureByText("a.md", """
|
||||
```py
|
||||
foo = 1
|
||||
f<caret>
|
||||
|
||||
```
|
||||
""".trimIndent())
|
||||
myFixture.completeBasic()
|
||||
assertContainsElements(lookupStrings, "foo")
|
||||
}
|
||||
|
||||
fun testPyConInjected() {
|
||||
myFixture.configureByText("a.md", """
|
||||
```pycon
|
||||
>>> foo = 1
|
||||
>>> f<caret>
|
||||
|
||||
```
|
||||
""".trimIndent())
|
||||
myFixture.completeBasic()
|
||||
assertContainsElements(lookupStrings, "foo")
|
||||
}
|
||||
|
||||
fun testPyConNoCompletionForUndefinedName() {
|
||||
myFixture.configureByText("a.md", """
|
||||
```pycon
|
||||
>>> print(foo)
|
||||
>>> f<caret>
|
||||
|
||||
```
|
||||
""".trimIndent())
|
||||
myFixture.completeBasic()
|
||||
assertDoesntContain(lookupStrings, "foo")
|
||||
}
|
||||
|
||||
fun testPythonReplInjected() {
|
||||
myFixture.configureByText("a.md", """
|
||||
```python-repl
|
||||
>>> foo = 1
|
||||
>>> f<caret>
|
||||
|
||||
```
|
||||
""".trimIndent())
|
||||
myFixture.completeBasic()
|
||||
assertContainsElements(lookupStrings, "foo")
|
||||
}
|
||||
|
||||
private val lookupStrings: List<String>
|
||||
get() = myFixture.lookupElementStrings ?: emptyList()
|
||||
}
|
||||
Reference in New Issue
Block a user