Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b1f235a

Browse files
committed
wip: keep PEP 695 Self test on supported runtimes
1 parent df349df commit b1f235a

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

test-data/unit/check-python312.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,14 @@ reveal_type(F[str]().m()) # N: Revealed type is "__main__.F[builtins.str]"
14461446
reveal_type(F[str]().mm(b'x')) # N: Revealed type is "tuple[__main__.F[builtins.str], builtins.bytes]"
14471447
[builtins fixtures/tuple.pyi]
14481448

1449+
[case testTypingSelfInvalidLocationsTypeParams]
1450+
# flags: --python-version 3.12
1451+
from typing import Self
1452+
1453+
class C:
1454+
def bounded[T: Self](self: T) -> None: ... # E: Self type cannot be used in a type parameter bound
1455+
def constrained[T: (C, Self)](self: T) -> None: ... # E: Self type cannot be used in a type parameter constraint
1456+
14491457
[case testPEP695CallAlias]
14501458
class C:
14511459
def __init__(self, x: str) -> None: ...

test-data/unit/check-selftype.test

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,14 +1494,6 @@ def func() -> None:
14941494

14951495
class C(Self): ... # E: Self type is only allowed in annotations within class definition
14961496

1497-
[case testTypingSelfInvalidLocationsTypeParams]
1498-
# flags: --python-version 3.12
1499-
from typing import Self
1500-
1501-
class C:
1502-
def bounded[T: Self](self: T) -> None: ... # E: Self type cannot be used in a type parameter bound
1503-
def constrained[T: (C, Self)](self: T) -> None: ... # E: Self type cannot be used in a type parameter constraint
1504-
15051497
[case testTypingSelfInvalidArgs]
15061498
from typing import Self, List
15071499

0 commit comments

Comments
 (0)