From 7a3717c7c86af5432dc9be60b59841fee78764b7 Mon Sep 17 00:00:00 2001 From: Andrey Vlasovskikh Date: Mon, 17 Apr 2017 18:47:09 +0300 Subject: [PATCH] One more test for PY-22808 to cover changes --- .../OverloadedNotMatchedGenericType.py | 6 ++++++ .../pyi/type/overloadedNotMatchedGenericType/m1.pyi | 9 +++++++++ python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java | 5 +++++ 3 files changed, 20 insertions(+) create mode 100644 python/testData/pyi/type/overloadedNotMatchedGenericType/OverloadedNotMatchedGenericType.py create mode 100644 python/testData/pyi/type/overloadedNotMatchedGenericType/m1.pyi diff --git a/python/testData/pyi/type/overloadedNotMatchedGenericType/OverloadedNotMatchedGenericType.py b/python/testData/pyi/type/overloadedNotMatchedGenericType/OverloadedNotMatchedGenericType.py new file mode 100644 index 000000000000..7d0f380f72e4 --- /dev/null +++ b/python/testData/pyi/type/overloadedNotMatchedGenericType/OverloadedNotMatchedGenericType.py @@ -0,0 +1,6 @@ +from typing import Any +from m1 import C + +def f(x: list): +c = C() +expr = c.foo(non_existing=0) diff --git a/python/testData/pyi/type/overloadedNotMatchedGenericType/m1.pyi b/python/testData/pyi/type/overloadedNotMatchedGenericType/m1.pyi new file mode 100644 index 000000000000..2466ad1c3b84 --- /dev/null +++ b/python/testData/pyi/type/overloadedNotMatchedGenericType/m1.pyi @@ -0,0 +1,9 @@ +from typing import TypeVar, Generic, overload, List, Dict + +_T = TypeVar('_T') + +class C(Generic[_T]): + @overload + def foo(self, i: int) -> Dict[str, _T]: ... + @overload + def foo(self, s: str) -> List[_T]: ... diff --git a/python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java b/python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java index 33d3dfdbffcb..73401bdc72cd 100644 --- a/python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java +++ b/python/testSrc/com/jetbrains/python/pyi/PyiTypeTest.java @@ -118,4 +118,9 @@ public class PyiTypeTest extends PyTestCase { public void testOverloadedNotMatchedType() { doTest("Union[list, Any]"); } + + // PY-22808 + public void testOverloadedNotMatchedGenericType() { + doTest("Union[Dict[str, Any], list]"); + } }