PY-13740 Django 1.7 QuerySet.as_manager() code completion support
authorIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Tue, 7 Oct 2014 13:53:30 +0000 (17:53 +0400)
committerIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Tue, 7 Oct 2014 13:53:30 +0000 (17:53 +0400)
python/testSrc/com/jetbrains/python/fixtures/PyTestCase.java

index 3528d7c6517d16c3faf6d7eb19ba834382807d4a..18dec8438a21bb5adf55039930f214ec710ad52c 100644 (file)
@@ -16,6 +16,7 @@
 package com.jetbrains.python.fixtures;
 
 import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.codeInsight.lookup.LookupElement;
 import com.intellij.codeInspection.LocalQuickFix;
 import com.intellij.codeInspection.ex.QuickFixWrapper;
 import com.intellij.execution.actions.ConfigurationContext;
@@ -71,6 +72,7 @@ import org.jetbrains.annotations.Nullable;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 
 /**
  * @author yole
@@ -240,6 +242,19 @@ public abstract class PyTestCase extends UsefulTestCase {
     return result;
   }
 
+  /**
+   * @return completion strings suggested by {@link com.intellij.testFramework.fixtures.CodeInsightTestFixture#completeBasic()}
+   */
+  @NotNull
+  protected List<String> getCompletionStrings() {
+    final LookupElement[] elements = myFixture.completeBasic();
+    final List<String> result = new ArrayList<String>(elements.length);
+    for (final LookupElement element : elements) {
+      result.add(element.getLookupString());
+    }
+    return result;
+  }
+
   protected static class PyLightProjectDescriptor implements LightProjectDescriptor {
     private final String myPythonVersion;