summaryrefslogtreecommitdiff
path: root/python/testSrc/com/jetbrains/python/Py3CompletionTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'python/testSrc/com/jetbrains/python/Py3CompletionTest.java')
-rw-r--r--python/testSrc/com/jetbrains/python/Py3CompletionTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/python/testSrc/com/jetbrains/python/Py3CompletionTest.java b/python/testSrc/com/jetbrains/python/Py3CompletionTest.java
index 1409ff490005..ca7c3c2649f3 100644
--- a/python/testSrc/com/jetbrains/python/Py3CompletionTest.java
+++ b/python/testSrc/com/jetbrains/python/Py3CompletionTest.java
@@ -18,6 +18,7 @@ package com.jetbrains.python;
import com.intellij.codeInsight.completion.impl.CamelHumpMatcher;
import com.intellij.testFramework.LightProjectDescriptor;
import com.jetbrains.python.fixtures.PyTestCase;
+import com.jetbrains.python.psi.LanguageLevel;
import java.util.List;
@@ -73,4 +74,23 @@ public class Py3CompletionTest extends PyTestCase {
myFixture.completeBasic();
return myFixture.getLookupElementStrings();
}
+
+ // PY-4073
+ public void testSpecialFunctionAttributesPy3() throws Exception {
+ setLanguageLevel(LanguageLevel.PYTHON32);
+ try {
+ List<String> suggested = doTestByText("def func(): pass; func.func_<caret>");
+ assertNotNull(suggested);
+ assertEmpty(suggested);
+
+ suggested = doTestByText("def func(): pass; func.__<caret>");
+ assertNotNull(suggested);
+ assertContainsElements(suggested, "__defaults__", "__globals__", "__closure__",
+ "__code__", "__name__", "__doc__", "__dict__", "__module__");
+ assertContainsElements(suggested, "__annotations__", "__kwdefaults__");
+ }
+ finally {
+ setLanguageLevel(null);
+ }
+ }
}