summaryrefslogtreecommitdiff
path: root/python/testSrc/com/jetbrains/python/PyTypeTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'python/testSrc/com/jetbrains/python/PyTypeTest.java')
-rw-r--r--python/testSrc/com/jetbrains/python/PyTypeTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/python/testSrc/com/jetbrains/python/PyTypeTest.java b/python/testSrc/com/jetbrains/python/PyTypeTest.java
index b0e41bcffddc..b6ed1090edad 100644
--- a/python/testSrc/com/jetbrains/python/PyTypeTest.java
+++ b/python/testSrc/com/jetbrains/python/PyTypeTest.java
@@ -835,6 +835,37 @@ public class PyTypeTest extends PyTestCase {
"expr = (1,) + (True, 'spam') + ()");
}
+ public void testConstructorUnification() {
+ doTest("C[int]",
+ "class C(object):\n" +
+ " def __init__(self, x):\n" +
+ " '''\n" +
+ " :type x: T\n" +
+ " :rtype: C[T]\n" +
+ " '''\n" +
+ " pass\n" +
+ "\n" +
+ "expr = C(10)\n");
+ }
+
+ public void testGenericClassMethodUnification() {
+ doTest("int",
+ "class C(object):\n" +
+ " def __init__(self, x):\n" +
+ " '''\n" +
+ " :type x: T\n" +
+ " :rtype: C[T]\n" +
+ " '''\n" +
+ " pass\n" +
+ " def foo(self):\n" +
+ " '''\n" +
+ " :rtype: T\n" +
+ " '''\n" +
+ " pass\n" +
+ "\n" +
+ "expr = C(10).foo()\n");
+ }
+
private static TypeEvalContext getTypeEvalContext(@NotNull PyExpression element) {
return TypeEvalContext.userInitiated(element.getContainingFile()).withTracing();
}