PY-71002 PEP-696: Add a set of tests that covers PEP's functionality

GitOrigin-RevId: 5d14970b62451233e8852df77a6938a18b3a17b9
This commit is contained in:
Daniil Kalinin
2024-09-07 11:11:13 +00:00
committed by intellij-monorepo-bot
parent cedd61e338
commit 6279c7a3c0
7 changed files with 1028 additions and 0 deletions
@@ -0,0 +1,6 @@
from typing import Generic, TypeVar
T = TypeVar('T', default=int)
class StackOfIntsByDefault(Generic[T]):
def pop(self) -> T: ...
@@ -0,0 +1,7 @@
from typing import Generic, TypeVar
T = TypeVar('T', default=int)
U = TypeVar('U', default=str)
class Box(Generic[T, U]):
val: T | U
@@ -0,0 +1,6 @@
from typing import Generic, TypeVar
T = TypeVar('T', default=int)
class StackOfIntsByDefault(Generic[T]):
def pop(self) -> T: ...
@@ -0,0 +1,2 @@
class StackOfIntsByDefault[T = int]:
def pop(self) -> T: ...
@@ -0,0 +1,4 @@
from typing import TypeVar, TypeAlias
T = TypeVar('T', default = int)
U = TypeVar('U', default = str)
StrIntDict: TypeAlias = dict[T, U]
@@ -0,0 +1,6 @@
from typing import TypeVar, TypeAlias, Generic
T = TypeVar('T')
U = TypeVar('U')
DefaultStrT = TypeVar('DefaultStrT', default = str)
class SomethingWithNoDefaults(Generic[T, T2]): ...
MyAlias: TypeAlias = SomethingWithNoDefaults[int, DefaultStrT]
File diff suppressed because it is too large Load Diff