2121from typemap .typing import (
2222 Attrs ,
2323 Bool ,
24- Cls ,
2524 FromUnion ,
2625 GenericCallable ,
2726 GetArg ,
@@ -1517,14 +1516,14 @@ def static_method(x: int) -> int: ...
15171516 """ )
15181517
15191518
1520- def test_type_eval_cls_01 ():
1521- res = eval_typing (Cls )
1522- assert res == Cls
1519+ def test_type_eval_type_self_01 ():
1520+ res = eval_typing (type ( Self ) )
1521+ assert res is type ( Self )
15231522
15241523
1525- def test_type_eval_cls_02 ():
1524+ def test_type_eval_type_self_02 ():
15261525 class A :
1527- child : Cls | None
1526+ child : type ( Self ) | None
15281527
15291528 class B (A ):
15301529 pass
@@ -1553,19 +1552,19 @@ class B(A):
15531552 fmt = format_helper .format_class (A )
15541553 assert fmt == textwrap .dedent ("""\
15551554 class A:
1556- child: tests.test_type_eval.test_type_eval_cls_02 .<locals>.A | None
1555+ child: tests.test_type_eval.test_type_eval_type_self_02 .<locals>.A | None
15571556 """ )
15581557 fmt = format_helper .format_class (B )
15591558 assert fmt == textwrap .dedent ("""\
15601559 class B:
1561- child: tests.test_type_eval.test_type_eval_cls_02 .<locals>.B | None
1560+ child: tests.test_type_eval.test_type_eval_type_self_02 .<locals>.B | None
15621561 """ )
15631562
15641563
1565- type ValueOrNone = GetAttr [Cls , Literal ["value" ]] | None
1564+ type ValueOrNone = GetAttr [type ( Self ) , Literal ["value" ]] | None
15661565
15671566
1568- def test_type_eval_cls_03 ():
1567+ def test_type_eval_type_self_03 ():
15691568 class A :
15701569 value : int
15711570 maybe : ValueOrNone
@@ -1595,7 +1594,7 @@ class A:
15951594 """ )
15961595
15971596
1598- def test_type_eval_cls_04 ():
1597+ def test_type_eval_type_self_04 ():
15991598 class A [T ]:
16001599 value : T
16011600 maybe : ValueOrNone
@@ -1660,7 +1659,7 @@ class A[T]:
16601659 )
16611660
16621661
1663- def test_type_eval_cls_05 ():
1662+ def test_type_eval_type_self_05 ():
16641663 class A :
16651664 value : str
16661665 maybe : ValueOrNone
@@ -1688,7 +1687,7 @@ class B:
16881687 )
16891688
16901689
1691- def test_type_eval_cls_06 ():
1690+ def test_type_eval_type_self_06 ():
16921691 class A [T ]:
16931692 value : T
16941693 maybe : ValueOrNone
@@ -1748,7 +1747,7 @@ class B[T, U]:
17481747)
17491748
17501749
1751- def test_type_eval_cls_07 ():
1750+ def test_type_eval_type_self_07 ():
17521751 class A :
17531752 value : int
17541753 maybe : ValueOrNone
@@ -1761,7 +1760,7 @@ class B:
17611760 assert eval_typing (AttrSetOfOnlyInt [B , Literal ["value" ]]) is str
17621761
17631762
1764- def test_type_eval_cls_08 ():
1763+ def test_type_eval_type_self_08 ():
17651764 class A [T ]:
17661765 value : T
17671766 maybe : ValueOrNone
0 commit comments