diff --git a/python/psi-api/src/com/jetbrains/python/PyNames.java b/python/psi-api/src/com/jetbrains/python/PyNames.java index 95bb618b0cd0..406010c5495d 100644 --- a/python/psi-api/src/com/jetbrains/python/PyNames.java +++ b/python/psi-api/src/com/jetbrains/python/PyNames.java @@ -392,6 +392,7 @@ public class PyNames { .put("__bool__", _only_self_descr) .put("__bytes__", _only_self_descr) .put("__format__", new BuiltinDescription("(self, format_spec)")) + .put("__prepare__", new BuiltinDescription("(metacls, name, bases)")) .put("__round__", new BuiltinDescription("(self, n=None)")) .put(DUNDER_NEXT, _only_self_descr) .build(); diff --git a/python/testData/completion/dunderPrepare.after.py b/python/testData/completion/dunderPrepare.after.py new file mode 100644 index 000000000000..58e89782d569 --- /dev/null +++ b/python/testData/completion/dunderPrepare.after.py @@ -0,0 +1,2 @@ +class C: + def __prepare__(metacls, name, bases): diff --git a/python/testData/completion/dunderPrepare.py b/python/testData/completion/dunderPrepare.py new file mode 100644 index 000000000000..115231603e49 --- /dev/null +++ b/python/testData/completion/dunderPrepare.py @@ -0,0 +1,2 @@ +class C: + def __prep diff --git a/python/testSrc/com/jetbrains/python/Py3CompletionTest.java b/python/testSrc/com/jetbrains/python/Py3CompletionTest.java index 32f8efe5fb8e..678fa212c5ef 100644 --- a/python/testSrc/com/jetbrains/python/Py3CompletionTest.java +++ b/python/testSrc/com/jetbrains/python/Py3CompletionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -160,6 +160,11 @@ public class Py3CompletionTest extends PyTestCase { runWithLanguageLevel(LanguageLevel.PYTHON35, () -> doTest()); } + // PY-17828 + public void testDunderPrepare() { + runWithLanguageLevel(LanguageLevel.PYTHON30, this::doTest); + } + @Override protected String getTestDataPath() { return super.getTestDataPath() + "/completion";