@@ -1530,3 +1530,102 @@ class C:
15301530[out]
15311531__main__.C.get_by_team_and_id
15321532__main__.Optional
1533+
1534+ [case testPEP695TypeAlias]
1535+ # flags: --enable-incomplete-feature=NewGenericSyntax --python-version=3.12
1536+ from typing_extensions import TypeAlias, TypeAliasType
1537+ type A = int
1538+ type B = str
1539+ type C = int
1540+ D = int
1541+ E: TypeAlias = int
1542+ F = TypeAliasType("F", int)
1543+ G = TypeAliasType("G", int)
1544+ type H = int
1545+
1546+ [file next.py]
1547+ # flags: --enable-incomplete-feature=NewGenericSyntax --python-version=3.12
1548+ from typing_extensions import TypeAlias, TypeAliasType
1549+ type A = str
1550+ type B = str
1551+ type C[T] = int
1552+ type D = int
1553+ type E = int
1554+ type F = int
1555+ type G = str
1556+ type H[T] = int
1557+
1558+ [builtins fixtures/tuple.pyi]
1559+ [typing fixtures/typing-full.pyi]
1560+ [out]
1561+ __main__.A
1562+ __main__.C
1563+ __main__.D
1564+ __main__.E
1565+ __main__.G
1566+ __main__.H
1567+
1568+ [case testPEP695TypeAlias2]
1569+ # flags: --enable-incomplete-feature=NewGenericSyntax --python-version=3.12
1570+ type A[T: int] = list[T]
1571+ type B[T: int] = list[T]
1572+ type C[T: (int, str)] = list[T]
1573+ type D[T: (int, str)] = list[T]
1574+ type E[T: int] = list[T]
1575+ type F[T: (int, str)] = list[T]
1576+
1577+ [file next.py]
1578+ # flags: --enable-incomplete-feature=NewGenericSyntax --python-version=3.12
1579+ type A[T] = list[T]
1580+ type B[T: str] = list[T]
1581+ type C[T: (int, None)] = list[T]
1582+ type D[T] = list[T]
1583+ type E[T: int] = list[T]
1584+ type F[T: (int, str)] = list[T]
1585+
1586+ [out]
1587+ __main__.A
1588+ __main__.B
1589+ __main__.C
1590+ __main__.D
1591+
1592+ [case testPEP695GenericFunction]
1593+ # flags: --enable-incomplete-feature=NewGenericSyntax --python-version=3.12
1594+ def f[T](x: T) -> T:
1595+ return x
1596+ def g[T](x: T, y: T) -> T:
1597+ return x
1598+ [file next.py]
1599+ # flags: --enable-incomplete-feature=NewGenericSyntax --python-version=3.12
1600+ def f[T](x: T) -> T:
1601+ return x
1602+ def g[T, S](x: T, y: S) -> S:
1603+ return y
1604+ [out]
1605+ __main__.g
1606+
1607+ [case testPEP695GenericClass]
1608+ # flags: --enable-incomplete-feature=NewGenericSyntax --python-version=3.12
1609+ class C[T]:
1610+ pass
1611+ class D[T]:
1612+ pass
1613+ class E[T]:
1614+ pass
1615+ class F[T]:
1616+ def f(self, x: object) -> T: ...
1617+ [file next.py]
1618+ # flags: --enable-incomplete-feature=NewGenericSyntax --python-version=3.12
1619+ class C[T]:
1620+ pass
1621+ class D[T: int]:
1622+ pass
1623+ class E:
1624+ pass
1625+ class F[T]:
1626+ def f(self, x: T) -> T: ...
1627+ [out]
1628+ __main__.D
1629+ __main__.E
1630+ __main__.F
1631+ __main__.F.f
0 commit comments